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: pkg/compiler/lib/src/compiler.dart

Issue 1248483008: Split MessageKind into a MessageKind key and a MessageTemplate. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 5 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 | « no previous file | pkg/compiler/lib/src/dart2jslib.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/compiler.dart
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index d35e5014312d3510a46c400781689bb9165c982b..1ed9781c039fa9b6849910582cd721ddb072c423 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -1162,14 +1162,17 @@ abstract class Compiler implements DiagnosticListener {
void unhandledExceptionOnElement(Element element) {
if (hasCrashed) return;
hasCrashed = true;
- reportDiagnostic(element,
- MessageKind.COMPILER_CRASHED.message(),
- api.Diagnostic.CRASH);
+ reportDiagnostic(
+ element,
+ MessageTemplate.TEMPLATES[MessageKind.COMPILER_CRASHED].message(),
+ api.Diagnostic.CRASH);
pleaseReportCrash();
}
void pleaseReportCrash() {
- print(MessageKind.PLEASE_REPORT_THE_CRASH.message({'buildId': buildId}));
+ print(
+ MessageTemplate.TEMPLATES[MessageKind.PLEASE_REPORT_THE_CRASH]
+ .message({'buildId': buildId}));
}
SourceSpan spanFromSpannable(Spannable node) {
@@ -1225,7 +1228,8 @@ abstract class Compiler implements DiagnosticListener {
void log(message) {
reportDiagnostic(null,
- MessageKind.GENERIC.message({'text': '$message'}),
+ MessageTemplate.TEMPLATES[MessageKind.GENERIC]
+ .message({'text': '$message'}),
api.Diagnostic.VERBOSE_INFO);
}
@@ -1239,9 +1243,11 @@ abstract class Compiler implements DiagnosticListener {
if (error is SpannableAssertionFailure) {
reportAssertionFailure(error);
} else {
- reportDiagnostic(new SourceSpan(uri, 0, 0),
- MessageKind.COMPILER_CRASHED.message(),
- api.Diagnostic.CRASH);
+ reportDiagnostic(
+ new SourceSpan(uri, 0, 0),
+ MessageTemplate.TEMPLATES[MessageKind.COMPILER_CRASHED]
+ .message(),
+ api.Diagnostic.CRASH);
}
pleaseReportCrash();
}
@@ -1379,7 +1385,7 @@ abstract class Compiler implements DiagnosticListener {
reportWarning(NO_LOCATION_SPANNABLE,
MessageKind.IMPORT_EXPERIMENTAL_MIRRORS,
{'importChain': importChains.join(
- MessageKind.IMPORT_EXPERIMENTAL_MIRRORS_PADDING)});
+ MessageTemplate.IMPORT_EXPERIMENTAL_MIRRORS_PADDING)});
}
}
@@ -1615,11 +1621,13 @@ abstract class Compiler implements DiagnosticListener {
} else if (info.hints == 0) {
kind = MessageKind.HIDDEN_WARNINGS;
}
+ MessageTemplate template = MessageTemplate.TEMPLATES[kind];
reportDiagnostic(null,
- kind.message({'warnings': info.warnings,
- 'hints': info.hints,
- 'uri': uri},
- terseDiagnostics),
+ template.message(
+ {'warnings': info.warnings,
+ 'hints': info.hints,
+ 'uri': uri},
+ terseDiagnostics),
api.Diagnostic.HINT);
});
}
@@ -1897,8 +1905,11 @@ abstract class Compiler implements DiagnosticListener {
}
}
lastDiagnosticWasFiltered = false;
+ MessageTemplate template = MessageTemplate.TEMPLATES[messageKind];
reportDiagnostic(
- node, messageKind.message(arguments, terseDiagnostics), kind);
+ node,
+ template.message(arguments, terseDiagnostics),
+ kind);
}
void reportDiagnostic(Spannable span,
« no previous file with comments | « no previous file | pkg/compiler/lib/src/dart2jslib.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698