Index: tests/compiler/dart2js/mock_compiler.dart |
diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart |
index 4ae9430a65d46c43a356bc6ca87533b377cafb7c..184463c4be43d9d0275d5261ea3a16206df89a98 100644 |
--- a/tests/compiler/dart2js/mock_compiler.dart |
+++ b/tests/compiler/dart2js/mock_compiler.dart |
@@ -437,3 +437,31 @@ class MockElement extends FunctionElementX { |
bool get hasNode => false; |
} |
+ |
+// TODO(herhut): Disallow warnings and errors during compilation by default. |
+MockCompiler compilerFor(String code, Uri uri, |
+ {bool analyzeAll: false, |
+ bool analyzeOnly: false, |
+ Map<String, String> coreSource, |
+ bool disableInlining: true, |
+ bool minify: false, |
+ bool trustTypeAnnotations: false, |
+ bool enableTypeAssertions: false, |
+ int expectedErrors, |
+ int expectedWarnings, |
+ api.CompilerOutputProvider outputProvider}) { |
+ MockCompiler compiler = new MockCompiler.internal( |
+ analyzeAll: analyzeAll, |
+ analyzeOnly: analyzeOnly, |
+ coreSource: coreSource, |
+ disableInlining: disableInlining, |
+ enableMinification: minify, |
+ trustTypeAnnotations: trustTypeAnnotations, |
+ enableTypeAssertions: enableTypeAssertions, |
+ expectedErrors: expectedErrors, |
+ expectedWarnings: expectedWarnings, |
+ outputProvider: outputProvider); |
+ compiler.registerSource(uri, code); |
+ compiler.diagnosticHandler = createHandler(compiler, code); |
+ return compiler; |
+} |