Index: compiler/javatests/com/google/dart/compiler/CompilerTestCase.java |
diff --git a/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java b/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java |
index 02f7c585394122a9230030383fd1318efd4f880a..3fa1139a0867705e807de9bd93d67d0e69c9fecd 100644 |
--- a/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java |
+++ b/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java |
@@ -8,6 +8,7 @@ import static com.google.dart.compiler.common.ErrorExpectation.assertErrors; |
import com.google.common.collect.Lists; |
import com.google.dart.compiler.CommandLineOptions.CompilerOptions; |
+import com.google.dart.compiler.ast.DartFunctionTypeAlias; |
import com.google.dart.compiler.ast.DartInvocation; |
import com.google.dart.compiler.ast.DartNewExpression; |
import com.google.dart.compiler.ast.DartNode; |
@@ -327,4 +328,18 @@ public abstract class CompilerTestCase extends TestCase { |
}); |
return result[0]; |
} |
+ |
+ protected static DartFunctionTypeAlias findTypedef(DartNode rootNode, final String name) { |
+ final DartFunctionTypeAlias result[] = new DartFunctionTypeAlias[1]; |
+ rootNode.accept(new DartNodeTraverser<Void>() { |
+ @Override |
+ public Void visitFunctionTypeAlias(DartFunctionTypeAlias node) { |
+ if (node.getName().getTargetName().equals(name)) { |
+ result[0] = node; |
+ } |
+ return null; |
+ } |
+ }); |
+ return result[0]; |
+ } |
} |