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

Unified Diff: tests/compiler/dart2js/type_test_helper.dart

Issue 1415463022: Use DiagnosticMessage in MockCompiler. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 1 month 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: tests/compiler/dart2js/type_test_helper.dart
diff --git a/tests/compiler/dart2js/type_test_helper.dart b/tests/compiler/dart2js/type_test_helper.dart
index e4c3ce3ce25cae667f928233021af07c8ef02f0b..df060084df170879535040f8004146baf40ddeca 100644
--- a/tests/compiler/dart2js/type_test_helper.dart
+++ b/tests/compiler/dart2js/type_test_helper.dart
@@ -37,8 +37,6 @@ class TypeEnvironment {
bool stopAfterTypeInference: false,
String mainSource}) {
Uri uri;
- Function getErrors;
- Function getWarnings;
Compiler compiler;
bool stopAfterTypeInference = mainSource != null;
if (mainSource == null) {
@@ -48,6 +46,7 @@ class TypeEnvironment {
} else {
source = '$mainSource\n$source';
}
+ memory.DiagnosticCollector collector;
if (useMockCompiler) {
uri = new Uri(scheme: 'source');
mock.MockCompiler mockCompiler = mock.compilerFor(
@@ -56,29 +55,26 @@ class TypeEnvironment {
analyzeAll: !stopAfterTypeInference,
analyzeOnly: !stopAfterTypeInference);
mockCompiler.diagnosticHandler = mock.createHandler(mockCompiler, source);
- getErrors = () => mockCompiler.errors;
- getWarnings = () => mockCompiler.warnings;
+ collector = mockCompiler.diagnosticCollector;
compiler = mockCompiler;
} else {
- memory.DiagnosticCollector collector = new memory.DiagnosticCollector();
+ collector = new memory.DiagnosticCollector();
uri = Uri.parse('memory:main.dart');
compiler = memory.compilerFor(
memorySourceFiles: {'main.dart': source},
diagnosticHandler: collector,
options: stopAfterTypeInference
? [] : [Flags.analyzeAll, Flags.analyzeOnly]);
- getErrors = () => collector.errors;
- getWarnings = () => collector.warnings;
}
compiler.stopAfterTypeInference = stopAfterTypeInference;
return compiler.run(uri).then((_) {
if (expectNoErrors || expectNoWarningsOrErrors) {
- var errors = getErrors();
+ var errors = collector.errors;
Expect.isTrue(errors.isEmpty,
'Unexpected errors: ${errors}');
}
if (expectNoWarningsOrErrors) {
- var warnings = getWarnings();
+ var warnings = collector.warnings;
Expect.isTrue(warnings.isEmpty,
'Unexpected warnings: ${warnings}');
}

Powered by Google App Engine
This is Rietveld 408576698