use of org.jetbrains.org.objectweb.asm.tree.FieldInsnNode in project kotlin by JetBrains.
the class RegeneratedLambdaFieldRemapper method getFieldForInline.
@Nullable
@Override
public StackValue getFieldForInline(@NotNull FieldInsnNode node, @Nullable StackValue prefix) {
assert node.name.startsWith("$$$") : "Captured field template should start with $$$ prefix";
if (node.name.equals("$$$" + InlineCodegenUtil.THIS)) {
assert oldOwnerType.equals(node.owner) : "Can't unfold '$$$THIS' parameter";
return StackValue.LOCAL_0;
}
FieldInsnNode fin = new FieldInsnNode(node.getOpcode(), node.owner, node.name.substring(3), node.desc);
CapturedParamInfo field = findFieldInMyCaptured(fin);
boolean searchInParent = false;
if (field == null) {
field = findFieldInMyCaptured(new FieldInsnNode(Opcodes.GETSTATIC, oldOwnerType, InlineCodegenUtil.THIS$0, Type.getObjectType(parent.getLambdaInternalName()).getDescriptor()));
searchInParent = true;
if (field == null) {
throw new IllegalStateException("Couldn't find captured this " + getLambdaInternalName() + " for " + node.name);
}
}
StackValue result = StackValue.field(field.isSkipped ? Type.getObjectType(parent.parent.getNewLambdaInternalName()) : field.getType(), Type.getObjectType(getNewLambdaInternalName()), /*TODO owner type*/
field.getNewFieldName(), false, prefix == null ? StackValue.LOCAL_0 : prefix);
return searchInParent ? parent.getFieldForInline(node, result) : result;
}
Aggregations