KT-4043 "Find usages ignores class names usages as class objects"
This commit is contained in:
@@ -377,18 +377,29 @@ public class BodyResolver {
|
||||
annotationResolver.resolveAnnotationsArguments(classDescriptor.getScopeForSupertypeResolution(), klass.getPrimaryConstructorModifierList(), trace);
|
||||
|
||||
if (unsubstitutedPrimaryConstructor != null) {
|
||||
WritableScope parameterScope = new WritableScopeImpl(classDescriptor.getScopeForSupertypeResolution(), unsubstitutedPrimaryConstructor,
|
||||
RedeclarationHandler.DO_NOTHING, "Scope with value parameters of a constructor");
|
||||
for (ValueParameterDescriptor valueParameterDescriptor : unsubstitutedPrimaryConstructor.getValueParameters()) {
|
||||
parameterScope.addVariableDescriptor(valueParameterDescriptor);
|
||||
}
|
||||
parameterScope.changeLockLevel(WritableScope.LockLevel.READING);
|
||||
WritableScope parameterScope = getPrimaryConstructorParametersScope(classDescriptor.getScopeForSupertypeResolution(), unsubstitutedPrimaryConstructor);
|
||||
expressionTypingServices.resolveValueParameters(klass.getPrimaryConstructorParameters(), unsubstitutedPrimaryConstructor.getValueParameters(),
|
||||
parameterScope, context.getOuterDataFlowInfo(), trace);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static WritableScope getPrimaryConstructorParametersScope(
|
||||
JetScope originalScope,
|
||||
ConstructorDescriptor unsubstitutedPrimaryConstructor
|
||||
) {
|
||||
WritableScope parameterScope = new WritableScopeImpl(
|
||||
originalScope,
|
||||
unsubstitutedPrimaryConstructor,
|
||||
RedeclarationHandler.DO_NOTHING, "Scope with value parameters of a constructor"
|
||||
);
|
||||
for (ValueParameterDescriptor valueParameterDescriptor : unsubstitutedPrimaryConstructor.getValueParameters()) {
|
||||
parameterScope.addVariableDescriptor(valueParameterDescriptor);
|
||||
}
|
||||
parameterScope.changeLockLevel(WritableScope.LockLevel.READING);
|
||||
return parameterScope;
|
||||
}
|
||||
|
||||
private void resolvePropertyDeclarationBodies() {
|
||||
|
||||
// Member properties
|
||||
@@ -595,6 +606,22 @@ public class BodyResolver {
|
||||
assert functionDescriptor.getReturnType() != null;
|
||||
}
|
||||
|
||||
public void resolveConstructorParameterDefaultValuesAndAnnotations(
|
||||
@NotNull BindingTrace trace,
|
||||
@NotNull JetClass klass,
|
||||
@NotNull ConstructorDescriptor constructorDescriptor,
|
||||
@NotNull JetScope declaringScope
|
||||
) {
|
||||
if (!context.completeAnalysisNeeded(klass)) return;
|
||||
|
||||
List<JetParameter> valueParameters = klass.getPrimaryConstructorParameters();
|
||||
List<ValueParameterDescriptor> valueParameterDescriptors = constructorDescriptor.getValueParameters();
|
||||
|
||||
JetScope scope = getPrimaryConstructorParametersScope(declaringScope, constructorDescriptor);
|
||||
|
||||
expressionTypingServices.resolveValueParameters(valueParameters, valueParameterDescriptors, scope, context.getOuterDataFlowInfo(), trace);
|
||||
}
|
||||
|
||||
private void resolveAnnotationArguments(@NotNull JetScope scope, @NotNull JetModifierListOwner owner) {
|
||||
annotationResolver.resolveAnnotationsArguments(scope, owner.getModifierList(), trace);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user