| 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}');
|
| }
|
|
|