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

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

Issue 1383483006: Extract DiagnosticReporter implementation from Compiler. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fixes after rebase. Created 5 years, 2 months 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/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);
« no previous file with comments | « tests/compiler/dart2js/diagnostic_reporter_helper.dart ('k') | tests/compiler/dart2js/js_spec_string_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698