Moved list of used visitors to separate methods in JetPsiChecker.

This commit is contained in:
Evgeny Gerashchenko
2012-03-29 14:56:20 +04:00
parent 0079df05b0
commit 494b489075
@@ -55,10 +55,25 @@ public class JetPsiChecker implements Annotator {
return errorReportingEnabled; 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 @Override
public void annotate(@NotNull PsiElement element, @NotNull final AnnotationHolder holder) { public void annotate(@NotNull PsiElement element, @NotNull final AnnotationHolder holder) {
element.accept(new SoftKeywordsHighlightingVisitor(holder)); for (HighlightingVisitor visitor : getBeforeAnalysisVisitors(holder)) {
element.accept(new LabelsHighlightingVisitor(holder)); element.accept(visitor);
}
if (element instanceof JetFile) { if (element instanceof JetFile) {
JetFile file = (JetFile)element; JetFile file = (JetFile)element;
@@ -77,8 +92,9 @@ public class JetPsiChecker implements Annotator {
} }
} }
file.acceptChildren(new BackingFieldHighlightingVisitor(holder, bindingContext)); for (HighlightingVisitor visitor : getAfterAnalysisVisitor(holder, bindingContext)) {
file.acceptChildren(new VariablesHighlightingVisitor(holder, bindingContext)); file.acceptChildren(visitor);
}
} }
catch (ProcessCanceledException e) { catch (ProcessCanceledException e) {
throw e; throw e;