diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/context/LocalLookup.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/context/LocalLookup.java index 9fa91f4fd51..0844c1c2a88 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/context/LocalLookup.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/context/LocalLookup.java @@ -55,7 +55,7 @@ public interface LocalLookup { Type type = sharedVarType != null ? sharedVarType : localType; KotlinType kotlinType = sharedVarType != null ? null : localKotlinType; - String fieldName = "$" + vd.getName(); + String fieldName = AsmUtil.getCapturedFieldName(vd.getName().asString()); StackValue.Local thiz = StackValue.LOCAL_0; StackValue.StackValueWithSimpleReceiver innerValue; @@ -113,7 +113,7 @@ public interface LocalLookup { int localClassIndexStart = simpleName.lastIndexOf('$'); String localFunSuffix = localClassIndexStart >= 0 ? simpleName.substring(localClassIndexStart) : ""; - String fieldName = "$" + vd.getName() + localFunSuffix; + String fieldName = AsmUtil.getCapturedFieldName(vd.getName().asString()) + localFunSuffix; StackValue.StackValueWithSimpleReceiver innerValue = StackValue.field( localType, null, classType, fieldName, false, StackValue.LOCAL_0, vd ); diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/MethodInliner.kt b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/MethodInliner.kt index 8031851df82..3ea47f61b0f 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/MethodInliner.kt +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/inline/MethodInliner.kt @@ -340,12 +340,12 @@ class MethodInliner( // 'This' in outer context corresponds to outer instance in current visitFieldInsn( Opcodes.GETSTATIC, owner, - CAPTURED_FIELD_FOLD_PREFIX + AsmUtil.CAPTURED_THIS_FIELD, capturedParamDesc.type.descriptor + FieldRemapper.foldName(AsmUtil.CAPTURED_THIS_FIELD), capturedParamDesc.type.descriptor ) } else { visitFieldInsn( Opcodes.GETSTATIC, capturedParamDesc.containingLambdaName, - CAPTURED_FIELD_FOLD_PREFIX + capturedParamDesc.fieldName, capturedParamDesc.type.descriptor + FieldRemapper.foldName(capturedParamDesc.fieldName), capturedParamDesc.type.descriptor ) } } @@ -1084,7 +1084,7 @@ class MethodInliner( private fun getCapturedFieldAccessChain(aload0: VarInsnNode): List { val lambdaAccessChain = mutableListOf(aload0).apply { addAll(InsnSequence(aload0.next, null).filter { it.isMeaningful }.takeWhile { insnNode -> - insnNode is FieldInsnNode && "this$0" == insnNode.name + insnNode is FieldInsnNode && AsmUtil.CAPTURED_THIS_FIELD == insnNode.name }.toList()) }