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

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

Issue 2746963002: Enable colors on-demand. (Closed)
Patch Set: Update color numbers. Created 3 years, 9 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 | « pkg/front_end/lib/src/fasta/colors.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 556ad819059e6da09bdd64219247a3be0e88fe22..040858c81ca4181fce81dd958968a743c8e42dfe 100644
--- a/pkg/front_end/lib/src/fasta/compiler_context.dart
+++ b/pkg/front_end/lib/src/fasta/compiler_context.dart
@@ -10,6 +10,8 @@ import 'package:kernel/ast.dart' show Source;
import 'compiler_command_line.dart' show CompilerCommandLine;
+import 'colors.dart' show computeEnableColors;
+
final Object compilerContextKey = new Object();
final CompilerContext rootContext =
@@ -20,6 +22,8 @@ class CompilerContext {
final Map<String, Source> uriToSource = <String, Source>{};
+ bool enableColorsCached = null;
+
CompilerContext(this.options);
static CompilerContext get current {
@@ -33,4 +37,8 @@ class CompilerContext {
CompilerContext c = new CompilerContext(cl);
return runZoned(() => action(c), zoneValues: {compilerContextKey: c});
}
+
+ static bool get enableColors {
+ return current.enableColorsCached ??= computeEnableColors(current);
+ }
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/colors.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698