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

Unified Diff: pkg/front_end/lib/src/fasta/compiler_context.dart

Issue 2977013002: Report messages instead of just printing. (Closed)
Patch Set: Update expectations. Created 3 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
Index: pkg/front_end/lib/src/fasta/compiler_context.dart
diff --git a/pkg/front_end/lib/src/fasta/compiler_context.dart b/pkg/front_end/lib/src/fasta/compiler_context.dart
index aba40fe5491a1ea521c6541e6aa2faa183136d10..2f427eaeb826a07ac60960659e58b074187f1cf1 100644
--- a/pkg/front_end/lib/src/fasta/compiler_context.dart
+++ b/pkg/front_end/lib/src/fasta/compiler_context.dart
@@ -14,6 +14,10 @@ import 'compiler_command_line.dart' show CompilerCommandLine;
import 'colors.dart' show computeEnableColors;
+import 'fasta_codes.dart' show LocatedMessage, Message;
+
+import 'severity.dart' show Severity;
+
final Object compilerContextKey = new Object();
final CompilerContext rootContext =
@@ -21,6 +25,7 @@ final CompilerContext rootContext =
class CompilerContext {
final FileSystem fileSystem = PhysicalFileSystem.instance;
+
final CompilerCommandLine options;
final Map<String, Source> uriToSource = <String, Source>{};
@@ -33,6 +38,26 @@ class CompilerContext {
enableColorsCached = false;
}
+ /// Report [message], for example, by printing it.
+ void report(LocatedMessage message, Severity severity) {
+ options.report(message, severity);
+ }
+
+ /// Report [message], for example, by printing it.
+ void reportWithoutLocation(Message message, Severity severity) {
+ options.reportWithoutLocation(message, severity);
+ }
+
+ /// Format [message] as a text string that can be included in generated code.
+ String format(LocatedMessage message, Severity severity) {
+ return options.format(message, severity);
+ }
+
+ /// Format [message] as a text string that can be included in generated code.
+ String formatWithoutLocation(Message message, Severity severity) {
+ return options.formatWithoutLocation(message, severity);
+ }
+
static CompilerContext get current {
return Zone.current[compilerContextKey] ?? rootContext;
}

Powered by Google App Engine
This is Rietveld 408576698