Generate access to private members through synthetic accessors in inline functions
This commit is contained in:
committed by
Max Kammerer
parent
3b02498ca8
commit
7851abd535
@@ -386,8 +386,10 @@ public abstract class CodegenContext<T extends DeclarationDescriptor> {
|
|||||||
@Nullable JetSuperExpression superCallExpression
|
@Nullable JetSuperExpression superCallExpression
|
||||||
) {
|
) {
|
||||||
DeclarationDescriptor enclosing = descriptor.getContainingDeclaration();
|
DeclarationDescriptor enclosing = descriptor.getContainingDeclaration();
|
||||||
if (!hasThisDescriptor() || enclosing == getThisDescriptor() ||
|
if (!isInlineMethodContext() && (
|
||||||
enclosing == getClassOrPackageParentContext().getContextDescriptor()) {
|
!hasThisDescriptor() ||
|
||||||
|
enclosing == getThisDescriptor() ||
|
||||||
|
enclosing == getClassOrPackageParentContext().getContextDescriptor())) {
|
||||||
return descriptor;
|
return descriptor;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,4 +480,19 @@ public abstract class CodegenContext<T extends DeclarationDescriptor> {
|
|||||||
private static boolean isStaticField(@NotNull StackValue value) {
|
private static boolean isStaticField(@NotNull StackValue value) {
|
||||||
return value instanceof StackValue.Field && ((StackValue.Field) value).isStaticPut;
|
return value instanceof StackValue.Field && ((StackValue.Field) value).isStaticPut;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isInsideInliningContext() {
|
||||||
|
CodegenContext current = this;
|
||||||
|
while (current != null) {
|
||||||
|
if (current instanceof MethodContext && ((MethodContext) current).isInlineFunction()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
current = current.getParentContext();
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isInlineMethodContext() {
|
||||||
|
return this instanceof MethodContext && ((MethodContext) this).isInlineFunction();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user