K2 Scripting: add FIR2IR conversion for FirScript
This commit is contained in:
committed by
Space Team
parent
47448d779c
commit
cc9a7480a2
@@ -24,9 +24,9 @@ class IrScriptImpl(
|
||||
override val symbol: IrScriptSymbol,
|
||||
override var name: Name,
|
||||
override val factory: IrFactory,
|
||||
override val startOffset: Int,
|
||||
override val endOffset: Int,
|
||||
) : IrScript() {
|
||||
override val startOffset: Int get() = UNDEFINED_OFFSET
|
||||
override val endOffset: Int get() = UNDEFINED_OFFSET
|
||||
override var origin: IrDeclarationOrigin = SCRIPT_ORIGIN
|
||||
|
||||
private var _parent: IrDeclarationParent? = null
|
||||
|
||||
@@ -127,6 +127,8 @@ open class DeepCopyIrTreeWithSymbols(
|
||||
symbolRemapper.getDeclaredScript(declaration.symbol),
|
||||
declaration.name,
|
||||
declaration.factory,
|
||||
declaration.startOffset,
|
||||
declaration.endOffset
|
||||
).also { scriptCopy ->
|
||||
scriptCopy.thisReceiver = declaration.thisReceiver.transform()
|
||||
declaration.statements.mapTo(scriptCopy.statements) { it.transform() }
|
||||
|
||||
@@ -429,9 +429,11 @@ open class SymbolTable(
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
fun declareScript(
|
||||
startOffset: Int,
|
||||
endOffset: Int,
|
||||
descriptor: ScriptDescriptor,
|
||||
scriptFactory: (IrScriptSymbol) -> IrScript = { symbol: IrScriptSymbol ->
|
||||
IrScriptImpl(symbol, nameProvider.nameForDeclaration(descriptor), irFactory)
|
||||
IrScriptImpl(symbol, nameProvider.nameForDeclaration(descriptor), irFactory, startOffset, endOffset)
|
||||
}
|
||||
): IrScript {
|
||||
return scriptSymbolTable.declare(
|
||||
@@ -441,6 +443,18 @@ open class SymbolTable(
|
||||
)
|
||||
}
|
||||
|
||||
fun declareScript(
|
||||
sig: IdSignature,
|
||||
symbolFactory: () -> IrScriptSymbol,
|
||||
scriptFactory: (IrScriptSymbol) -> IrScript
|
||||
): IrScript {
|
||||
return scriptSymbolTable.declare(
|
||||
sig,
|
||||
symbolFactory,
|
||||
scriptFactory
|
||||
)
|
||||
}
|
||||
|
||||
@ObsoleteDescriptorBasedAPI
|
||||
override fun referenceScript(descriptor: ScriptDescriptor): IrScriptSymbol =
|
||||
scriptSymbolTable.referenced(descriptor) { IrScriptSymbolImpl(descriptor) }
|
||||
|
||||
Reference in New Issue
Block a user