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

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

Issue 169763003: Update dart2js diagnostics to prepare for filtering. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove optional Uri. Created 6 years, 10 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/mock_compiler.dart
diff --git a/tests/compiler/dart2js/mock_compiler.dart b/tests/compiler/dart2js/mock_compiler.dart
index aca4c783796c401f44ac9ad02b06a91173127e55..ac63a438a1839f3dc8d16656ba70ec5d6c19b41f 100644
--- a/tests/compiler/dart2js/mock_compiler.dart
+++ b/tests/compiler/dart2js/mock_compiler.dart
@@ -339,35 +339,13 @@ class MockCompiler extends Compiler {
return library;
}
- void reportWarning(Spannable node, var message) {
- if (message is! Message) message = message.message;
- warnings.add(new WarningMessage(node, message));
- reportDiagnostic(spanFromSpannable(node),
- 'Warning: $message', api.Diagnostic.WARNING);
- }
-
- void reportError(Spannable node,
- MessageKind errorCode,
- [Map arguments = const {}]) {
- Message message = errorCode.message(arguments);
- errors.add(new WarningMessage(node, message));
- reportDiagnostic(spanFromSpannable(node), '$message', api.Diagnostic.ERROR);
- }
-
- void reportInfo(Spannable node,
- MessageKind errorCode,
- [Map arguments = const {}]) {
- Message message = errorCode.message(arguments);
- infos.add(new WarningMessage(node, message));
- reportDiagnostic(spanFromSpannable(node), '$message', api.Diagnostic.INFO);
- }
-
- void reportHint(Spannable node,
- MessageKind errorCode,
- [Map arguments = const {}]) {
- Message message = errorCode.message(arguments);
- hints.add(new WarningMessage(node, message));
- reportDiagnostic(spanFromSpannable(node), '$message', api.Diagnostic.HINT);
+ // TODO(johnniwinther): Remove this when we don't filter certain type checker
+ // warnings.
+ void reportWarning(Spannable node, MessageKind errorCode,
+ [Map arguments = const {}]) {
+ reportDiagnostic(node,
+ errorCode.error(arguments, terseDiagnostics),
+ api.Diagnostic.WARNING);
}
void reportFatalError(Spannable node,
@@ -376,8 +354,10 @@ class MockCompiler extends Compiler {
reportError(node, errorCode, arguments);
}
- void reportMessage(SourceSpan span, var message, api.Diagnostic kind) {
- var diagnostic = new WarningMessage(null, message.message);
+ void reportDiagnostic(Spannable node,
+ Diagnostic message,
+ api.Diagnostic kind) {
+ var diagnostic = new WarningMessage(node, message.message);
if (kind == api.Diagnostic.ERROR) {
errors.add(diagnostic);
} else if (kind == api.Diagnostic.WARNING) {
@@ -387,15 +367,12 @@ class MockCompiler extends Compiler {
} else if (kind == api.Diagnostic.HINT) {
hints.add(diagnostic);
}
- reportDiagnostic(span, "$message", kind);
- }
-
- void reportDiagnostic(SourceSpan span, String message, api.Diagnostic kind) {
if (diagnosticHandler != null) {
+ SourceSpan span = spanFromSpannable(node);
if (span != null) {
- diagnosticHandler(span.uri, span.begin, span.end, message, kind);
+ diagnosticHandler(span.uri, span.begin, span.end, '$message', kind);
} else {
- diagnosticHandler(null, null, null, message, kind);
+ diagnosticHandler(null, null, null, '$message', kind);
}
}
}

Powered by Google App Engine
This is Rietveld 408576698