JVM: do not write trivial SMAPs to classes outside inline funs

where trivial == those that map the file to itself.
This commit is contained in:
pyos
2020-04-23 14:42:22 +02:00
committed by max-kammerer
parent a04aeeb4e1
commit d17a18f96d
30 changed files with 121 additions and 204 deletions
@@ -89,8 +89,6 @@ abstract class ClassCodegen protected constructor(
)
}
internal var writeSourceMap: Boolean = withinInline
private var regeneratedObjectNameGenerators = mutableMapOf<String, NameGenerator>()
fun getRegeneratedObjectNameGenerator(function: IrFunction): NameGenerator {
@@ -145,7 +143,7 @@ abstract class ClassCodegen protected constructor(
generateInnerAndOuterClasses()
if (writeSourceMap) {
if (withinInline || !smap.isTrivial) {
visitor.visitSMAP(smap, !context.state.languageVersionSettings.supportsFeature(LanguageFeature.CorrectSourceMappingSyntax))
} else {
visitor.visitSource(smap.sourceInfo!!.source, null)
@@ -86,7 +86,7 @@ class IrSourceCompilerForInline(
}
override val lazySourceMapper: SourceMapper
get() = codegen.smap.also { codegen.classCodegen.writeSourceMap = true }
get() = codegen.smap
override fun generateLambdaBody(lambdaInfo: ExpressionLambda): SMAPAndMethodNode =
FunctionCodegen((lambdaInfo as IrExpressionLambdaImpl).function, codegen.classCodegen, codegen).generate()