Use scope based on constructor descriptor (rather than class itself) when
resolving class initializers
This commit is contained in:
+2
-2
@@ -210,14 +210,14 @@ public class LazyClassDescriptor extends ClassDescriptorBase implements LazyDesc
|
|||||||
ConstructorDescriptor primaryConstructor = getUnsubstitutedPrimaryConstructor();
|
ConstructorDescriptor primaryConstructor = getUnsubstitutedPrimaryConstructor();
|
||||||
if (primaryConstructor == null) return getScopeForMemberDeclarationResolution();
|
if (primaryConstructor == null) return getScopeForMemberDeclarationResolution();
|
||||||
|
|
||||||
WritableScopeImpl scope = new WritableScopeImpl(JetScope.EMPTY, this, RedeclarationHandler.DO_NOTHING, "Scope with constructor parameters in " + getName());
|
WritableScopeImpl scope = new WritableScopeImpl(JetScope.EMPTY, primaryConstructor, RedeclarationHandler.DO_NOTHING, "Scope with constructor parameters in " + getName());
|
||||||
for (ValueParameterDescriptor valueParameterDescriptor : primaryConstructor.getValueParameters()) {
|
for (ValueParameterDescriptor valueParameterDescriptor : primaryConstructor.getValueParameters()) {
|
||||||
scope.addVariableDescriptor(valueParameterDescriptor);
|
scope.addVariableDescriptor(valueParameterDescriptor);
|
||||||
}
|
}
|
||||||
scope.changeLockLevel(WritableScope.LockLevel.READING);
|
scope.changeLockLevel(WritableScope.LockLevel.READING);
|
||||||
|
|
||||||
return new ChainedScope(
|
return new ChainedScope(
|
||||||
this,
|
primaryConstructor,
|
||||||
"ScopeForPropertyInitializerResolution: " + getName(),
|
"ScopeForPropertyInitializerResolution: " + getName(),
|
||||||
scope, getScopeForMemberDeclarationResolution());
|
scope, getScopeForMemberDeclarationResolution());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user