minor: small cleanup in K2 scripting support code

This commit is contained in:
Ilya Chernikov
2023-07-17 16:15:09 +02:00
committed by Space Team
parent 895a811b47
commit 776cdbcd3f
4 changed files with 8 additions and 13 deletions
@@ -330,16 +330,13 @@ class Fir2IrConverter(
declarationStorage.enterScope(irScript)
irScript.parent = parent
for (scriptStatement in declaration.statements) {
if (scriptStatement is FirDeclaration) {
when (scriptStatement) {
is FirRegularClass -> {
registerClassAndNestedClasses(scriptStatement, irScript)
processClassAndNestedClassHeaders(scriptStatement)
}
is FirTypeAlias -> classifierStorage.registerTypeAlias(scriptStatement, irScript)
else -> {}
when (scriptStatement) {
is FirRegularClass -> {
registerClassAndNestedClasses(scriptStatement, irScript)
processClassAndNestedClassHeaders(scriptStatement)
}
is FirTypeAlias -> classifierStorage.registerTypeAlias(scriptStatement, irScript)
else -> {}
}
}
for (scriptStatement in declaration.statements) {
@@ -71,7 +71,7 @@ class Fir2IrVisitor(
private val operatorGenerator = OperatorExpressionGenerator(components, this, conversionScope)
private var _annotationMode: Boolean = false
public val annotationMode: Boolean
val annotationMode: Boolean
get() = _annotationMode
private fun FirTypeRef.toIrType(): IrType = with(typeConverter) { toIrType() }
@@ -491,7 +491,7 @@ object NodeConfigurator : AbstractFieldConfigurator<FirTreeBuilder>(FirTreeBuild
+name
+fieldList(statement).withTransform()
+symbol("FirScriptSymbol")
+FieldList("parameters", variable, withReplace = false)
+fieldList("parameters", variable, withReplace = false)
+fieldList(contextReceiver, useMutableOrEmpty = true)
+field("resultPropertyName", nameType, nullable = true)
}
@@ -86,9 +86,7 @@ object PathUtil {
val KOTLIN_SCRIPTING_PLUGIN_CLASSPATH_JARS = arrayOf(
KOTLIN_SCRIPTING_COMPILER_PLUGIN_JAR, KOTLIN_SCRIPTING_COMPILER_IMPL_JAR,
KOTLINX_COROUTINES_CORE_JAR,
KOTLIN_SCRIPTING_COMMON_JAR, KOTLIN_SCRIPTING_JVM_JAR,
JS_ENGINES_JAR
)
const val KOTLIN_TEST_NAME = "kotlin-test"