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

Unified Diff: tests/compiler/dart2js/mock_compiler.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/js_spec_string_test.dart ('k') | tests/compiler/dart2js/parser_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/mock_compiler.dart
diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart
index 06265f4982ce8066c1fdc6febb37a6a360d8355c..9f67d129426ab1935f1bc6495855b60380c6d317 100644
--- a/tests/compiler/dart2js/mock_compiler.dart
+++ b/tests/compiler/dart2js/mock_compiler.dart
@@ -194,37 +194,41 @@ class MockCompiler extends Compiler {
// TODO(johnniwinther): Remove this when we don't filter certain type checker
// warnings.
- void reportWarning(Spannable node, MessageKind messageKind,
- [Map arguments = const {}]) {
- MessageTemplate template = MessageTemplate.TEMPLATES[messageKind];
- reportDiagnostic(node,
- template.message(arguments, terseDiagnostics),
- api.Diagnostic.WARNING);
+ void reportWarning(
+ DiagnosticMessage message,
+ [List<DiagnosticMessage> infos = const <DiagnosticMessage>[]]) {
+ reportDiagnostic(message, infos, api.Diagnostic.WARNING);
}
- void reportDiagnostic(Spannable node,
- Message message,
+ void reportDiagnostic(DiagnosticMessage message,
+ List<DiagnosticMessage> infoMessages,
api.Diagnostic kind) {
- var diagnostic = new WarningMessage(node, message);
- if (kind == api.Diagnostic.CRASH) {
- crashes.add(diagnostic);
- } else if (kind == api.Diagnostic.ERROR) {
- errors.add(diagnostic);
- } else if (kind == api.Diagnostic.WARNING) {
- warnings.add(diagnostic);
- } else if (kind == api.Diagnostic.INFO) {
- infos.add(diagnostic);
- } else if (kind == api.Diagnostic.HINT) {
- hints.add(diagnostic);
- }
- if (diagnosticHandler != null) {
- SourceSpan span = spanFromSpannable(node);
- if (span != null) {
- diagnosticHandler(span.uri, span.begin, span.end, '$message', kind);
- } else {
- diagnosticHandler(null, null, null, '$message', kind);
+
+ void processMessage(DiagnosticMessage message, api.Diagnostic kind) {
+ var diagnostic = new WarningMessage(message.spannable, message.message);
+ if (kind == api.Diagnostic.CRASH) {
+ crashes.add(diagnostic);
+ } else if (kind == api.Diagnostic.ERROR) {
+ errors.add(diagnostic);
+ } else if (kind == api.Diagnostic.WARNING) {
+ warnings.add(diagnostic);
+ } else if (kind == api.Diagnostic.INFO) {
+ infos.add(diagnostic);
+ } else if (kind == api.Diagnostic.HINT) {
+ hints.add(diagnostic);
+ }
+ if (diagnosticHandler != null) {
+ SourceSpan span = message.sourceSpan;
+ if (span != null) {
+ diagnosticHandler(span.uri, span.begin, span.end, '$message', kind);
+ } else {
+ diagnosticHandler(null, null, null, '$message', kind);
+ }
}
}
+
+ processMessage(message, kind);
+ infoMessages.forEach((i) => processMessage(i, api.Diagnostic.INFO));
}
bool get compilationFailed => !crashes.isEmpty || !errors.isEmpty;
« no previous file with comments | « tests/compiler/dart2js/js_spec_string_test.dart ('k') | tests/compiler/dart2js/parser_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698