From 494b489075d1897851a5eba762d7de21866d7f42 Mon Sep 17 00:00:00 2001 From: Evgeny Gerashchenko Date: Thu, 29 Mar 2012 14:56:20 +0400 Subject: [PATCH] Moved list of used visitors to separate methods in JetPsiChecker. --- .../jet/plugin/highlighter/JetPsiChecker.java | 24 +++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/idea/src/org/jetbrains/jet/plugin/highlighter/JetPsiChecker.java b/idea/src/org/jetbrains/jet/plugin/highlighter/JetPsiChecker.java index b26abca8fc1..55bac4696e8 100644 --- a/idea/src/org/jetbrains/jet/plugin/highlighter/JetPsiChecker.java +++ b/idea/src/org/jetbrains/jet/plugin/highlighter/JetPsiChecker.java @@ -55,10 +55,25 @@ public class JetPsiChecker implements Annotator { return errorReportingEnabled; } + private static HighlightingVisitor[] getBeforeAnalysisVisitors(AnnotationHolder holder) { + return new HighlightingVisitor[]{ + new SoftKeywordsHighlightingVisitor(holder), + new LabelsHighlightingVisitor(holder), + }; + } + + private static HighlightingVisitor[] getAfterAnalysisVisitor(AnnotationHolder holder, BindingContext bindingContext) { + return new AfterAnalysisHighlightingVisitor[]{ + new BackingFieldHighlightingVisitor(holder, bindingContext), + new VariablesHighlightingVisitor(holder, bindingContext), + }; + } + @Override public void annotate(@NotNull PsiElement element, @NotNull final AnnotationHolder holder) { - element.accept(new SoftKeywordsHighlightingVisitor(holder)); - element.accept(new LabelsHighlightingVisitor(holder)); + for (HighlightingVisitor visitor : getBeforeAnalysisVisitors(holder)) { + element.accept(visitor); + } if (element instanceof JetFile) { JetFile file = (JetFile)element; @@ -77,8 +92,9 @@ public class JetPsiChecker implements Annotator { } } - file.acceptChildren(new BackingFieldHighlightingVisitor(holder, bindingContext)); - file.acceptChildren(new VariablesHighlightingVisitor(holder, bindingContext)); + for (HighlightingVisitor visitor : getAfterAnalysisVisitor(holder, bindingContext)) { + file.acceptChildren(visitor); + } } catch (ProcessCanceledException e) { throw e;