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

Unified Diff: tests/compiler/dart2js/parser_helper.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
« no previous file with comments | « tests/compiler/dart2js/metadata_test.dart ('k') | tests/compiler/dart2js/parser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/parser_helper.dart
diff --git a/tests/compiler/dart2js/parser_helper.dart b/tests/compiler/dart2js/parser_helper.dart
index ff603cd61e46749c575c43ca4a8ce7a8ddafc7f7..572a082ffaa0ddbd823ac9908f43115085623c58 100644
--- a/tests/compiler/dart2js/parser_helper.dart
+++ b/tests/compiler/dart2js/parser_helper.dart
@@ -37,7 +37,7 @@ export 'package:compiler/src/parser/partial_elements.dart';
export "package:compiler/src/tokens/token.dart";
export "package:compiler/src/tokens/token_constants.dart";
-class LoggerCanceler extends DiagnosticListener {
+class LoggerCanceler extends DiagnosticReporter {
void log(message) {
print(message);
}
@@ -93,15 +93,15 @@ Token scan(String text) =>
.tokenize();
Node parseBodyCode(String text, Function parseMethod,
- {DiagnosticListener diagnosticHandler}) {
+ {DiagnosticReporter reporter}) {
Token tokens = scan(text);
- if (diagnosticHandler == null) diagnosticHandler = new LoggerCanceler();
+ if (reporter == null) reporter = new LoggerCanceler();
Uri uri = new Uri(scheme: "source");
Script script = new Script(uri, uri,new MockFile(text));
LibraryElement library = new LibraryElementX(script);
library.canUseNative = true;
NodeListener listener =
- new NodeListener(diagnosticHandler, library.entryCompilationUnit);
+ new NodeListener(reporter, library.entryCompilationUnit);
Parser parser = new Parser(listener);
Token endToken = parseMethod(parser, tokens);
assert(endToken.kind == EOF_TOKEN);
@@ -121,9 +121,11 @@ Node parseFunction(String text, Compiler compiler) {
return element.parseNode(compiler.parsing);
}
-Node parseMember(String text, {DiagnosticListener diagnosticHandler}) {
- return parseBodyCode(text, (parser, tokens) => parser.parseMember(tokens),
- diagnosticHandler: diagnosticHandler);
+Node parseMember(String text, {DiagnosticReporter reporter}) {
+ return parseBodyCode(
+ text,
+ (parser, tokens) => parser.parseMember(tokens),
+ reporter: reporter);
}
class MockFile extends StringSourceFile {
@@ -144,13 +146,16 @@ Link<Element> parseUnit(String text, Compiler compiler,
var script = new Script(uri, uri, new MockFile(text));
var unit = new CompilationUnitElementX(script, library);
int id = 0;
- ElementListener listener = new ElementListener(compiler, unit, () => id++);
+ DiagnosticReporter reporter = compiler.reporter;
+ ElementListener listener = new ElementListener(reporter, unit, () => id++);
PartialParser parser = new PartialParser(listener);
- compiler.withCurrentElement(unit, () => parser.parseUnit(tokens));
+ reporter.withCurrentElement(unit, () => parser.parseUnit(tokens));
return unit.localMembers;
}
-NodeList fullParseUnit(String source, {DiagnosticListener diagnosticHandler}) {
- return parseBodyCode(source, (parser, tokens) => parser.parseUnit(tokens),
- diagnosticHandler: diagnosticHandler);
+NodeList fullParseUnit(String source, {DiagnosticReporter reporter}) {
+ return parseBodyCode(
+ source,
+ (parser, tokens) => parser.parseUnit(tokens),
+ reporter: reporter);
}
« no previous file with comments | « tests/compiler/dart2js/metadata_test.dart ('k') | tests/compiler/dart2js/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698