Minor: Get rid of some magic constants
This commit is contained in:
@@ -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
|
||||
);
|
||||
|
||||
@@ -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<AbstractInsnNode> {
|
||||
val lambdaAccessChain = mutableListOf<AbstractInsnNode>(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())
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user