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

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

Issue 1363993004: Report info messages together with their error, warning, or hint. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comment. Created 5 years, 3 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/mock_compiler.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 da04e381244cca620d963e920cefada396b49760..ea49b68cc66ed0dbfca0a45dd330e22417a14fc7 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 implements DiagnosticListener {
+class LoggerCanceler extends DiagnosticListener {
void log(message) {
print(message);
}
@@ -50,33 +50,42 @@ class LoggerCanceler implements DiagnosticListener {
throw 'unsupported operation';
}
- void reportMessage(SourceSpan span, Message message, kind) {
+ void reportError(
+ DiagnosticMessage message,
+ [List<DiagnosticMessage> infos = const <DiagnosticMessage>[]]) {
log(message);
+ infos.forEach(log);
}
- void reportFatalError(Spannable node,
- MessageKind errorCode,
- [Map arguments]) {
- log(new Message(MessageTemplate.TEMPLATES[errorCode], arguments, false));
- }
-
- void reportError(Spannable node, MessageKind errorCode, [Map arguments]) {
- log(new Message(MessageTemplate.TEMPLATES[errorCode], arguments, false));
- }
-
- void reportWarning(Spannable node, MessageKind errorCode, [Map arguments]) {
- log(new Message(MessageTemplate.TEMPLATES[errorCode], arguments, false));
+ void reportWarning(
+ DiagnosticMessage message,
+ [List<DiagnosticMessage> infos = const <DiagnosticMessage>[]]) {
+ log(message);
+ infos.forEach(log);
}
void reportInfo(Spannable node, MessageKind errorCode, [Map arguments]) {
log(new Message(MessageTemplate.TEMPLATES[errorCode], arguments, false));
}
- void reportHint(Spannable node, MessageKind errorCode, [Map arguments]) {
- log(new Message(MessageTemplate.TEMPLATES[errorCode], arguments, false));
+ void reportHint(
+ DiagnosticMessage message,
+ [List<DiagnosticMessage> infos = const <DiagnosticMessage>[]]) {
+ log(message);
+ infos.forEach(log);
}
withCurrentElement(Element element, f()) => f();
+
+ @override
+ DiagnosticMessage createMessage(
+ Spannable spannable,
+ MessageKind messageKind,
+ [Map arguments = const {}]) {
+ return new DiagnosticMessage(
+ null, spannable,
+ new Message(MessageTemplate.TEMPLATES[messageKind], arguments, false));
+ }
}
Token scan(String text) =>
« no previous file with comments | « tests/compiler/dart2js/mock_compiler.dart ('k') | tests/compiler/dart2js/parser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698