KT-4043 "Find usages ignores class names usages as class objects"

This commit is contained in:
Alexey Sedunov
2013-10-16 17:59:13 +04:00
parent 45b07c0e18
commit 12a460a145
6 changed files with 69 additions and 14 deletions
@@ -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);
}