usage 'call.getCallElement' instead of 'call.getCalleeExpression' while 'invisible member' error reporting

This commit is contained in:
Svetlana Isakova
2012-04-30 15:42:26 +04:00
parent 36224dd32c
commit 09c065b371
2 changed files with 15 additions and 1 deletions
@@ -51,7 +51,7 @@ public interface Errors {
//Elements with "INVISIBLE_REFERENCE" error are marked as unresolved, unlike elements with "INVISIBLE_MEMBER" error
DiagnosticFactory2<JetSimpleNameExpression, DeclarationDescriptor, DeclarationDescriptor> INVISIBLE_REFERENCE =
DiagnosticFactory2.create(ERROR);
DiagnosticFactory2<PsiElement, DeclarationDescriptor, DeclarationDescriptor> INVISIBLE_MEMBER = DiagnosticFactory2.create(ERROR);
DiagnosticFactory2<PsiElement, DeclarationDescriptor, DeclarationDescriptor> INVISIBLE_MEMBER = DiagnosticFactory2.create(ERROR, PositioningStrategies.CALL_ELEMENT);
RedeclarationDiagnosticFactory REDECLARATION = new RedeclarationDiagnosticFactory(ERROR);
RedeclarationDiagnosticFactory NAME_SHADOWING = new RedeclarationDiagnosticFactory(WARNING);
@@ -151,4 +151,18 @@ public class PositioningStrategies {
return markNode(element.getDefaultValue().getNode());
}
};
public static PositioningStrategy<PsiElement> CALL_ELEMENT = new PositioningStrategy<PsiElement>() {
@NotNull
@Override
public List<TextRange> mark(@NotNull PsiElement callElement) {
if (callElement instanceof JetCallElement) {
JetExpression calleeExpression = ((JetCallElement) callElement).getCalleeExpression();
if (calleeExpression != null) {
return markElement(calleeExpression);
}
}
return markElement(callElement);
}
};
}