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

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

Issue 8786002: Check that interface constructors and default class constructors are compatible. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Check that types of constructors parameters are identical Created 9 years 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 3c2cd900ba6edcd21be9322fa86c20cc1e1d269b..21e9f2b83f5e5660c10323b51594cd6efa2e172c 100644
--- a/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
+++ b/compiler/javatests/com/google/dart/compiler/CompilerTestCase.java
@@ -6,6 +6,10 @@ package com.google.dart.compiler;
import com.google.common.collect.Lists;
import com.google.dart.compiler.CommandLineOptions.CompilerOptions;
+import com.google.dart.compiler.ast.DartInvocation;
+import com.google.dart.compiler.ast.DartNewExpression;
+import com.google.dart.compiler.ast.DartNode;
+import com.google.dart.compiler.ast.DartNodeTraverser;
import com.google.dart.compiler.ast.DartUnit;
import com.google.dart.compiler.ast.LibraryUnit;
import com.google.dart.compiler.parser.DartParser;
@@ -103,6 +107,10 @@ public abstract class CompilerTestCase extends TestCase {
return compilationErrors;
}
+ public List<DartCompilationError> getTypeErrors() {
+ return typeErrors;
+ }
+
/**
* @param lib
*/
@@ -343,4 +351,22 @@ public abstract class CompilerTestCase extends TestCase {
}
}
}
+
+ /**
+ * @return the {@link DartInvocation} 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];
+ rootNode.accept(new DartNodeTraverser<Void>() {
zundel 2011/12/05 21:26:45 To simplify, you can make DartNodeTraverser<DartNe
scheglov 2011/12/06 14:20:39 Does not work because of limitations of DartNodeTr
+ @Override
+ public Void visitNewExpression(DartNewExpression node) {
+ if (node.toSource().equals(sampleSource)) {
+ result[0] = node;
+ }
+ return super.visitInvocation(node);
+ }
+ });
+ return result[0];
+ }
}

Powered by Google App Engine
This is Rietveld 408576698