When in debugger context, access private companion object directly

This commit is contained in:
Dmitry Petrov
2018-06-26 12:40:33 +03:00
parent bef3d4ace2
commit 46a3f7420c
9 changed files with 89 additions and 6 deletions
@@ -2651,12 +2651,9 @@ public class ExpressionCodegen extends KtVisitor<StackValue, StackValue> impleme
"Containing declaration of the companion object " + companionObjectDescriptor +
": expected a class, actual: " + hostClassDescriptor;
CodegenContext hostClassContext = context;
while (hostClassContext.getContextDescriptor() != hostClassDescriptor) {
hostClassContext = hostClassContext.getParentContext();
assert hostClassContext != null :
"Host class context for " + hostClassDescriptor + " not found in context hierarchy for " + context;
}
CodegenContext hostClassContext = context.findParentContextWithDescriptor(hostClassDescriptor);
assert hostClassContext != null :
"Host class context for " + hostClassDescriptor + " not found in context hierarchy for " + context;
hostClassContext.markCompanionObjectDescriptorWithAccessorRequired(companionObjectDescriptor);
@@ -159,6 +159,10 @@ public class JvmCodegenUtil {
return true;
}
if (isDebuggerContext(contextBeforeInline)) {
return true;
}
CodegenContext context = contextBeforeInline.getFirstCrossInlineOrNonInlineContext();
if (context.isInlineMethodContext()) {
// Inline method can be called from a nested class.