K2 Scripting: add support for imported scripts
This commit is contained in:
committed by
Space Team
parent
d24fc3b581
commit
96bde033e1
@@ -43,6 +43,8 @@ abstract class IrScript : IrDeclarationBase(), IrDeclarationWithName, IrDeclarat
|
||||
|
||||
abstract var earlierScriptsParameter: IrValueParameter?
|
||||
|
||||
abstract var importedScripts: List<IrScriptSymbol>?
|
||||
|
||||
abstract var earlierScripts: List<IrScriptSymbol>?
|
||||
|
||||
abstract var targetClass: IrClassSymbol?
|
||||
|
||||
@@ -53,6 +53,7 @@ class IrScriptImpl(
|
||||
override lateinit var providedPropertiesParameters: List<IrValueParameter>
|
||||
override var resultProperty: IrPropertySymbol? = null
|
||||
override var earlierScriptsParameter: IrValueParameter? = null
|
||||
override var importedScripts: List<IrScriptSymbol>? = null
|
||||
override var earlierScripts: List<IrScriptSymbol>? = null
|
||||
override var targetClass: IrClassSymbol? = null
|
||||
override var constructor: IrConstructor? = null
|
||||
|
||||
@@ -131,6 +131,7 @@ open class DeepCopyIrTreeWithSymbols(
|
||||
).also { scriptCopy ->
|
||||
scriptCopy.thisReceiver = declaration.thisReceiver?.transform()
|
||||
declaration.statements.mapTo(scriptCopy.statements) { it.transform() }
|
||||
scriptCopy.importedScripts = declaration.importedScripts
|
||||
scriptCopy.earlierScripts = declaration.earlierScripts
|
||||
scriptCopy.earlierScriptsParameter = declaration.earlierScriptsParameter
|
||||
scriptCopy.explicitCallParameters = declaration.explicitCallParameters.memoryOptimizedMap { it.transform() }
|
||||
|
||||
@@ -548,6 +548,7 @@ object IrTree : AbstractTreeBuilder() {
|
||||
+listField("providedPropertiesParameters", valueParameter, mutability = Var, isChild = true)
|
||||
+field("resultProperty", propertySymbolType, nullable = true)
|
||||
+field("earlierScriptsParameter", valueParameter, nullable = true, isChild = true)
|
||||
+listField("importedScripts", scriptSymbolType, mutability = Var, nullable = true)
|
||||
+listField("earlierScripts", scriptSymbolType, mutability = Var, nullable = true)
|
||||
+field("targetClass", classSymbolType, nullable = true)
|
||||
+field("constructor", constructor, nullable = true) // K1
|
||||
|
||||
Reference in New Issue
Block a user