| Index: tests/compiler/dart2js/exit_code_test.dart
|
| diff --git a/tests/compiler/dart2js/exit_code_test.dart b/tests/compiler/dart2js/exit_code_test.dart
|
| index acb111b7aaa1c5b04f4c0768ac0cc1ff7de04188..ff039751d7a542607cb3a901e4a049dda2821c24 100644
|
| --- a/tests/compiler/dart2js/exit_code_test.dart
|
| +++ b/tests/compiler/dart2js/exit_code_test.dart
|
| @@ -17,6 +17,7 @@ import 'package:compiler/src/common/codegen.dart';
|
| import 'package:compiler/src/compile_time_constants.dart';
|
| import 'package:compiler/src/compiler.dart';
|
| import 'package:compiler/src/dart2js.dart' as entry;
|
| +import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
|
| import 'package:compiler/src/diagnostics/invariant.dart';
|
| import 'package:compiler/src/diagnostics/messages.dart';
|
| import 'package:compiler/src/diagnostics/spannable.dart';
|
| @@ -28,11 +29,13 @@ import 'package:compiler/src/null_compiler_output.dart';
|
| import 'package:compiler/src/old_to_new_api.dart';
|
| import 'package:compiler/src/resolution/resolution.dart';
|
| import 'package:compiler/src/scanner/scanner_task.dart';
|
| +import 'diagnostic_reporter_helper.dart';
|
|
|
| class TestCompiler extends apiimpl.Compiler {
|
| final String testMarker;
|
| final String testType;
|
| final Function onTest;
|
| + DiagnosticReporter reporter;
|
|
|
| TestCompiler(api.CompilerInput inputProvider,
|
| api.CompilerOutput outputProvider,
|
| @@ -50,6 +53,7 @@ class TestCompiler extends apiimpl.Compiler {
|
| packageRoot, options, environment, packageConfig, findPackages) {
|
| scanner = new TestScanner(this);
|
| resolver = new TestResolver(this, backend.constantCompilerTask);
|
| + reporter = new TestDiagnosticReporter(this, super.reporter);
|
| test('Compiler');
|
| }
|
|
|
| @@ -78,13 +82,6 @@ class TestCompiler extends apiimpl.Compiler {
|
| return super.codegen(work, world);
|
| }
|
|
|
| - withCurrentElement(Element element, f()) {
|
| - return super.withCurrentElement(element, () {
|
| - test('Compiler.withCurrentElement');
|
| - return f();
|
| - });
|
| - }
|
| -
|
| test(String marker) {
|
| if (marker == testMarker) {
|
| switch (testType) {
|
| @@ -98,19 +95,19 @@ class TestCompiler extends apiimpl.Compiler {
|
| break;
|
| case 'warning':
|
| onTest(testMarker, testType);
|
| - reportWarning(createMessage(
|
| + reporter.reportWarningMessage(
|
| NO_LOCATION_SPANNABLE,
|
| - MessageKind.GENERIC, {'text': marker}));
|
| + MessageKind.GENERIC, {'text': marker});
|
| break;
|
| case 'error':
|
| onTest(testMarker, testType);
|
| - reportError(createMessage(
|
| + reporter.reportErrorMessage(
|
| NO_LOCATION_SPANNABLE,
|
| - MessageKind.GENERIC, {'text': marker}));
|
| + MessageKind.GENERIC, {'text': marker});
|
| break;
|
| case 'internalError':
|
| onTest(testMarker, testType);
|
| - internalError(NO_LOCATION_SPANNABLE, marker);
|
| + reporter.internalError(NO_LOCATION_SPANNABLE, marker);
|
| break;
|
| case 'NoSuchMethodError':
|
| onTest(testMarker, testType);
|
| @@ -124,6 +121,21 @@ class TestCompiler extends apiimpl.Compiler {
|
| }
|
| }
|
|
|
| +class TestDiagnosticReporter extends DiagnosticReporterWrapper {
|
| + final TestCompiler compiler;
|
| + final DiagnosticReporter reporter;
|
| +
|
| + TestDiagnosticReporter(this.compiler, this.reporter);
|
| +
|
| + @override
|
| + withCurrentElement(Element element, f()) {
|
| + return super.withCurrentElement(element, () {
|
| + compiler.test('Compiler.withCurrentElement');
|
| + return f();
|
| + });
|
| + }
|
| +}
|
| +
|
| class TestScanner extends ScannerTask {
|
| TestScanner(TestCompiler compiler) : super(compiler);
|
|
|
|
|