JS IR: gather statement origins in one place
Preparing to serialize lowered IR
This commit is contained in:
committed by
TeamCityServer
parent
1b2f4ad071
commit
a4cb70af31
+2
-4
@@ -281,8 +281,6 @@ private fun IrFunction.findBaseFunctionWithDefaultArguments(skipInlineMethods: B
|
||||
return dfsImpl()
|
||||
}
|
||||
|
||||
val DEFAULT_DISPATCH_CALL = object : IrStatementOriginImpl("DEFAULT_DISPATCH_CALL") {}
|
||||
|
||||
open class DefaultParameterInjector(
|
||||
open val context: CommonBackendContext,
|
||||
private val skipInline: Boolean = true,
|
||||
@@ -338,7 +336,7 @@ open class DefaultParameterInjector(
|
||||
expression.transformChildrenVoid()
|
||||
return visitFunctionAccessExpression(expression) {
|
||||
with(expression) {
|
||||
IrConstructorCallImpl.fromSymbolOwner(startOffset, endOffset, type, it as IrConstructorSymbol, DEFAULT_DISPATCH_CALL)
|
||||
IrConstructorCallImpl.fromSymbolOwner(startOffset, endOffset, type, it as IrConstructorSymbol, LoweredStatementOrigins.DEFAULT_DISPATCH_CALL)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -364,7 +362,7 @@ open class DefaultParameterInjector(
|
||||
startOffset, endOffset, type, it as IrSimpleFunctionSymbol,
|
||||
typeArgumentsCount = typeArgumentsCount,
|
||||
valueArgumentsCount = it.owner.valueParameters.size,
|
||||
origin = DEFAULT_DISPATCH_CALL,
|
||||
origin = LoweredStatementOrigins.DEFAULT_DISPATCH_CALL,
|
||||
superQualifierSymbol = superQualifierSymbol
|
||||
)
|
||||
}
|
||||
|
||||
+1
-3
@@ -23,8 +23,6 @@ import org.jetbrains.kotlin.ir.visitors.IrElementTransformerVoid
|
||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
||||
import org.jetbrains.kotlin.ir.visitors.transformChildrenVoid
|
||||
|
||||
object SYNTHESIZED_INIT_BLOCK : IrStatementOriginImpl("SYNTHESIZED_INIT_BLOCK")
|
||||
|
||||
class InitializersLowering(context: CommonBackendContext) : InitializersLoweringBase(context), BodyLoweringPass {
|
||||
override fun lower(irFile: IrFile) {
|
||||
runOnFilePostfix(irFile, true)
|
||||
@@ -88,7 +86,7 @@ abstract class InitializersLoweringBase(open val context: CommonBackendContext)
|
||||
|
||||
private fun handleAnonymousInitializer(declaration: IrAnonymousInitializer): IrStatement =
|
||||
with(declaration) {
|
||||
IrBlockImpl(startOffset, endOffset, context.irBuiltIns.unitType, SYNTHESIZED_INIT_BLOCK, body.statements)
|
||||
IrBlockImpl(startOffset, endOffset, context.irBuiltIns.unitType, LoweredStatementOrigins.SYNTHESIZED_INIT_BLOCK, body.statements)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-4
@@ -90,9 +90,6 @@ class LocalDeclarationsLowering(
|
||||
object DECLARATION_ORIGIN_FIELD_FOR_CROSSINLINE_CAPTURED_VALUE :
|
||||
IrDeclarationOriginImpl("FIELD_FOR_CROSSINLINE_CAPTURED_VALUE", isSynthetic = true)
|
||||
|
||||
private object STATEMENT_ORIGIN_INITIALIZER_OF_FIELD_FOR_CAPTURED_VALUE :
|
||||
IrStatementOriginImpl("INITIALIZER_OF_FIELD_FOR_CAPTURED_VALUE")
|
||||
|
||||
override fun lower(irBody: IrBody, container: IrDeclaration) {
|
||||
LocalDeclarationsTransformer(irBody, container, null).lowerLocalDeclarations()
|
||||
}
|
||||
@@ -490,7 +487,7 @@ class LocalDeclarationsLowering(
|
||||
IrGetValueImpl(UNDEFINED_OFFSET, UNDEFINED_OFFSET, irClass.thisReceiver!!.symbol),
|
||||
constructorContext.irGet(UNDEFINED_OFFSET, UNDEFINED_OFFSET, capturedValue)!!,
|
||||
context.irBuiltIns.unitType,
|
||||
STATEMENT_ORIGIN_INITIALIZER_OF_FIELD_FOR_CAPTURED_VALUE
|
||||
LoweredStatementOrigins.STATEMENT_ORIGIN_INITIALIZER_OF_FIELD_FOR_CAPTURED_VALUE
|
||||
)
|
||||
}
|
||||
)
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Copyright 2010-2021 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.backend.common.lower
|
||||
|
||||
import org.jetbrains.kotlin.ir.expressions.IrStatementOriginImpl
|
||||
|
||||
interface LoweredStatementOrigins {
|
||||
object STATEMENT_ORIGIN_INITIALIZER_OF_FIELD_FOR_CAPTURED_VALUE : IrStatementOriginImpl("INITIALIZER_OF_FIELD_FOR_CAPTURED_VALUE")
|
||||
object SYNTHESIZED_INIT_BLOCK : IrStatementOriginImpl("SYNTHESIZED_INIT_BLOCK")
|
||||
object DEFAULT_DISPATCH_CALL : IrStatementOriginImpl("DEFAULT_DISPATCH_CALL")
|
||||
}
|
||||
Reference in New Issue
Block a user