Using isTopLevelDeclaration instaed of a direct instanceof check
This commit is contained in:
@@ -21,6 +21,7 @@ import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.jet.lang.descriptors.*;
|
||||
import org.jetbrains.jet.lang.psi.*;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
|
||||
public class FunctionsHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
public FunctionsHighlightingVisitor(AnnotationHolder holder, BindingContext bindingContext) {
|
||||
@@ -65,7 +66,7 @@ public class FunctionsHighlightingVisitor extends AfterAnalysisHighlightingVisit
|
||||
else if (calleeDescriptor instanceof FunctionDescriptor) {
|
||||
FunctionDescriptor fun = (FunctionDescriptor)calleeDescriptor;
|
||||
JetPsiChecker.highlightName(holder, callee, JetHighlightingColors.FUNCTION_CALL);
|
||||
if (fun.getContainingDeclaration() instanceof NamespaceDescriptor) {
|
||||
if (DescriptorUtils.isTopLevelDeclaration(fun)) {
|
||||
JetPsiChecker.highlightName(holder, callee, JetHighlightingColors.NAMESPACE_FUNCTION_CALL);
|
||||
}
|
||||
if (fun.getReceiverParameter() != null) {
|
||||
|
||||
@@ -25,6 +25,7 @@ import org.jetbrains.jet.lang.psi.JetProperty;
|
||||
import org.jetbrains.jet.lang.psi.JetSimpleNameExpression;
|
||||
import org.jetbrains.jet.lang.psi.JetThisExpression;
|
||||
import org.jetbrains.jet.lang.resolve.BindingContext;
|
||||
import org.jetbrains.jet.lang.resolve.DescriptorUtils;
|
||||
import org.jetbrains.jet.lexer.JetTokens;
|
||||
|
||||
class PropertiesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
@@ -77,7 +78,7 @@ class PropertiesHighlightingVisitor extends AfterAnalysisHighlightingVisitor {
|
||||
private void highlightProperty(@NotNull PsiElement elementToHighlight,
|
||||
@NotNull PropertyDescriptor descriptor,
|
||||
boolean withBackingField) {
|
||||
boolean namespace = descriptor.getContainingDeclaration() instanceof NamespaceDescriptor;
|
||||
boolean namespace = DescriptorUtils.isTopLevelDeclaration(descriptor);
|
||||
JetPsiChecker.highlightName(holder, elementToHighlight,
|
||||
namespace ? JetHighlightingColors.NAMESPACE_PROPERTY : JetHighlightingColors.INSTANCE_PROPERTY
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user