JVM_IR: use fresh source map when generating lambda body for inline.

This commit is contained in:
Jinseong Jeon
2020-03-10 00:36:25 -07:00
committed by max-kammerer
parent 72b80ef158
commit 2352b1fec5
7 changed files with 34 additions and 15 deletions
@@ -343,7 +343,18 @@ open class ClassCodegen protected constructor(
}
fun createLocalClassCodegen(klass: IrClass, parentFunction: IrFunction): ClassCodegen =
ClassCodegen(klass, context, this, parentFunction, withinInline = withinInline || parentFunction.isInline)
ClassCodegen(klass, context, this, parentFunction, withinInline = withinInline || parentFunction.isInline)
fun createClassCodegenForLambdaBody(parentClass: IrClass, lambda: IrFunction): ClassCodegen =
object : ClassCodegen(parentClass, context, parentFunction = parentFunction, withinInline = withinInline) {
override fun createClassBuilder(): ClassBuilder {
return object : AbstractClassBuilder() {
override fun getVisitor(): ClassVisitor {
TODO("Expect to be _not_ reached")
}
}
}
}
private fun generateField(field: IrField) {
if (field.origin == IrDeclarationOrigin.FAKE_OVERRIDE) return
@@ -117,8 +117,10 @@ class IrSourceCompilerForInline(
return SMAPAndMethodNode(node!!, SMAP(classCodegen.getOrCreateSourceMapper().resultMappings))
}
override fun generateLambdaBody(lambdaInfo: ExpressionLambda): SMAPAndMethodNode =
makeInlineNode((lambdaInfo as IrExpressionLambdaImpl).function, codegen.classCodegen, true)
override fun generateLambdaBody(lambdaInfo: ExpressionLambda): SMAPAndMethodNode {
val function = (lambdaInfo as IrExpressionLambdaImpl).function
return makeInlineNode(function, codegen.classCodegen.createClassCodegenForLambdaBody(codegen.classCodegen.irClass, function), true)
}
override fun doCreateMethodNodeFromSource(
callableDescriptor: FunctionDescriptor,