Wrap parentCodegen before generating from inline
This commit is contained in:
@@ -86,6 +86,10 @@ public abstract class MemberCodegen<T extends JetElement/* TODO: & JetDeclaratio
|
||||
this.propertyCodegen = new PropertyCodegen(context, v, functionCodegen, this);
|
||||
}
|
||||
|
||||
protected MemberCodegen(@NotNull MemberCodegen<T> wrapped) {
|
||||
this(wrapped.state, wrapped.getParentCodegen(), wrapped.getContext(), wrapped.element, wrapped.v);
|
||||
}
|
||||
|
||||
public void generate() {
|
||||
generateDeclaration();
|
||||
|
||||
|
||||
@@ -192,11 +192,7 @@ public class InlineCodegen implements CallGenerator {
|
||||
);
|
||||
}
|
||||
else {
|
||||
FunctionCodegen.generateMethodBody(
|
||||
maxCalcAdapter, functionDescriptor, methodContext, jvmSignature,
|
||||
new FunctionGenerationStrategy.FunctionDefault(state, functionDescriptor, (JetDeclarationWithBody) element),
|
||||
parentCodegen
|
||||
);
|
||||
generateMethodBody(maxCalcAdapter, functionDescriptor, methodContext, (JetDeclarationWithBody) element, jvmSignature);
|
||||
}
|
||||
maxCalcAdapter.visitMaxs(-1, -1);
|
||||
maxCalcAdapter.visitEnd();
|
||||
@@ -277,13 +273,55 @@ public class InlineCodegen implements CallGenerator {
|
||||
|
||||
MethodVisitor adapter = InlineCodegenUtil.wrapWithMaxLocalCalc(methodNode);
|
||||
|
||||
FunctionCodegen.generateMethodBody(adapter, descriptor, context, jvmMethodSignature, new FunctionGenerationStrategy.FunctionDefault(state, descriptor, declaration), codegen.getParentCodegen());
|
||||
generateMethodBody(adapter, descriptor, context, declaration, jvmMethodSignature);
|
||||
adapter.visitMaxs(-1, -1);
|
||||
|
||||
return methodNode;
|
||||
}
|
||||
|
||||
private void generateMethodBody(
|
||||
@NotNull MethodVisitor adapter,
|
||||
@NotNull FunctionDescriptor descriptor,
|
||||
@NotNull MethodContext context,
|
||||
@NotNull JetDeclarationWithBody declaration,
|
||||
@NotNull JvmMethodSignature jvmMethodSignature
|
||||
) {
|
||||
FunctionCodegen.generateMethodBody(
|
||||
adapter, descriptor, context, jvmMethodSignature,
|
||||
new FunctionGenerationStrategy.FunctionDefault(state, descriptor, declaration),
|
||||
// Wrapping for preventing marking actual parent codegen as containing reifier markers
|
||||
new FakeMemberCodegen(codegen.getParentCodegen())
|
||||
);
|
||||
}
|
||||
|
||||
private static class FakeMemberCodegen extends MemberCodegen {
|
||||
private final MemberCodegen delegate;
|
||||
public FakeMemberCodegen(@NotNull MemberCodegen wrapped) {
|
||||
super(wrapped);
|
||||
delegate = wrapped;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateDeclaration() {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateBody() {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void generateKotlinAnnotation() {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public NameGenerator getInlineNameGenerator() {
|
||||
return delegate.getInlineNameGenerator();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterParameterPut(@NotNull Type type, @Nullable StackValue stackValue, @Nullable ValueParameterDescriptor valueParameterDescriptor) {
|
||||
|
||||
Reference in New Issue
Block a user