no exponent in processing groovy 1.8 script fields (IDEA-69871)

This commit is contained in:
peter
2011-05-23 15:40:37 +02:00
parent 118f6a93fe
commit 4b6d8343f3
2 changed files with 24 additions and 12 deletions
@@ -17,9 +17,7 @@ package org.jetbrains.plugins.groovy.lang.psi.impl.synthetic;
import com.intellij.navigation.ItemPresentation;
import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.*;
import com.intellij.psi.*;
import com.intellij.psi.impl.ElementBase;
import com.intellij.psi.impl.ElementPresentationUtil;
@@ -355,20 +353,29 @@ public class GroovyScriptClass extends LightElement implements GrMemberOwner, Sy
return CachedValuesManager.getManager(getProject()).getCachedValue(this, new CachedValueProvider<List<GrVariable>>() {
@Override
public Result<List<GrVariable>> compute() {
final List<GrVariable> result = new ArrayList<GrVariable>();
myFile.accept(new PsiRecursiveElementWalkingVisitor() {
List<GrVariable> result = RecursionManager.createGuard("groovy.scriptFields").doPreventingRecursion(GroovyScriptClass.this, new Computable<List<GrVariable>>() {
@Override
public void visitElement(PsiElement element) {
if (element instanceof GrVariableDeclaration &&
((GrVariableDeclaration)element).getModifierList().findAnnotation(GroovyCommonClassNames.GROOVY_TRANSFORM_FIELD) != null) {
Collections.addAll(result, ((GrVariableDeclaration)element).getVariables());
}
public List<GrVariable> compute() {
final List<GrVariable> result = new ArrayList<GrVariable>();
myFile.accept(new PsiRecursiveElementWalkingVisitor() {
@Override
public void visitElement(PsiElement element) {
if (element instanceof GrVariableDeclaration &&
((GrVariableDeclaration)element).getModifierList().findAnnotation(GroovyCommonClassNames.GROOVY_TRANSFORM_FIELD) != null) {
Collections.addAll(result, ((GrVariableDeclaration)element).getVariables());
}
super.visitElement(element);
super.visitElement(element);
}
});
return result;
}
});
return Result.create(result, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT, myFile);
if (result == null) {
result = Collections.emptyList();
}
return Result.create(result, PsiModificationTracker.JAVA_STRUCTURE_MODIFICATION_COUNT, myFile);
}
});
}
@@ -128,4 +128,9 @@ class GroovyStressTest extends LightCodeInsightFixtureTestCase {
}
public void testManyAnnotatedScriptVariables() {
myFixture.configureByText("a.groovy", (0..100).collect { "@Anno String i$it = null" }.join("\n"))
IdeaTestUtil.assertTiming "slow", 10000, { myFixture.doHighlighting() }
}
}