JVM_IR. Align synthetic parameter name generation across backends

This commit is contained in:
Mikhael Bogdanov
2020-01-28 14:49:31 +01:00
parent c42984ca33
commit 17e89fbbdb
3 changed files with 5 additions and 11 deletions
@@ -278,6 +278,7 @@ class ExpressionCodegen(
}
private fun writeParameterInLocalVariableTable(startLabel: Label, endLabel: Label) {
if (irFunction.origin == IrDeclarationOrigin.FUNCTION_FOR_DEFAULT_PARAMETER) return
if (!irFunction.isStatic) {
mv.visitLocalVariable("this", classCodegen.type.descriptor, null, startLabel, endLabel, 0)
}
@@ -286,9 +287,7 @@ class ExpressionCodegen(
writeValueParameterInLocalVariableTable(extensionReceiverParameter, startLabel, endLabel, true)
}
for (param in irFunction.valueParameters) {
if (!param.origin.isSynthetic) {
writeValueParameterInLocalVariableTable(param, startLabel, endLabel, false)
}
writeValueParameterInLocalVariableTable(param, startLabel, endLabel, false)
}
}
@@ -7,6 +7,8 @@ package org.jetbrains.kotlin.backend.jvm.lower
import org.jetbrains.kotlin.backend.common.FileLoweringPass
import org.jetbrains.kotlin.backend.common.IrElementTransformerVoidWithContext
import org.jetbrains.kotlin.backend.common.descriptors.synthesizedName
import org.jetbrains.kotlin.backend.common.descriptors.synthesizedString
import org.jetbrains.kotlin.backend.common.ir.*
import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
import org.jetbrains.kotlin.backend.jvm.JvmLoweredDeclarationOrigin
@@ -177,7 +179,7 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle
accessor.returnType = source.returnType.remapTypeParameters(source, accessor)
accessor.addValueParameter(
"marker", context.ir.symbols.defaultConstructorMarker.defaultType, JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR
"constructor_marker".synthesizedString, context.ir.symbols.defaultConstructorMarker.defaultType, JvmLoweredDeclarationOrigin.SYNTHETIC_ACCESSOR
)
accessor.body = IrExpressionBodyImpl(
@@ -3,13 +3,6 @@
fun foo(param: String = "123") {}
//TODO: align backends
// JVM_TEMPLATES
// 1 LOCALVARIABLE param
// 1 LOCALVARIABLE
// JVM_IR_TEMPLATES
// 2 LOCALVARIABLE param
// 2 LOCALVARIABLE