Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Unified Diff: compiler/javatests/com/google/dart/compiler/CompilerTestCase.java

Issue 10537043: Issue 3308. Support for operator equals (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 2dd3581b7f1081b1466f737552c8a7d4a1800b6c..56c374dfff1f9e0aa5b1889729d1daf8350e181f 100644
--- a/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
+++ b/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
@@ -8,6 +8,7 @@ import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.dart.compiler.CommandLineOptions.CompilerOptions;
import com.google.dart.compiler.ast.ASTVisitor;
+import com.google.dart.compiler.ast.DartExpression;
import com.google.dart.compiler.ast.DartFunctionTypeAlias;
import com.google.dart.compiler.ast.DartInvocation;
import com.google.dart.compiler.ast.DartNewExpression;
@@ -368,21 +369,22 @@ public abstract class CompilerTestCase extends TestCase {
assertErrors(errors, expectedWarnings);
}
/**
- * @return the {@link DartInvocation} with given source. This is inaccurate approach, but good
+ * @return the {@link DartExpression} with given source. This is inaccurate approach, but good
* enough for specific tests.
*/
- protected static DartNewExpression findNewExpression(DartNode rootNode, final String sampleSource) {
- final DartNewExpression result[] = new DartNewExpression[1];
+ @SuppressWarnings("unchecked")
+ protected static <T extends DartExpression> T findExpression(DartNode rootNode, final String sampleSource) {
+ final DartExpression result[] = new DartExpression[1];
rootNode.accept(new ASTVisitor<Void>() {
@Override
- public Void visitNewExpression(DartNewExpression node) {
+ public Void visitExpression(DartExpression node) {
if (node.toSource().equals(sampleSource)) {
result[0] = node;
}
- return super.visitInvocation(node);
+ return super.visitExpression(node);
}
});
- return result[0];
+ return (T) result[0];
}
protected static DartFunctionTypeAlias findTypedef(DartNode rootNode, final String name) {

Powered by Google App Engine
This is Rietveld 408576698