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

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

Issue 2757593003: Work around Platform.ansiSupported missing from checked-in dart binary. (Closed)
Patch Set: Address comments. 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 | « no previous file | 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/colors.dart
diff --git a/pkg/front_end/lib/src/fasta/colors.dart b/pkg/front_end/lib/src/fasta/colors.dart
index f3891b917d50387f3ccdc2b196cefd395f55e936..753da3d181688a4ddb34891097516cfbd511f231 100644
--- a/pkg/front_end/lib/src/fasta/colors.dart
+++ b/pkg/front_end/lib/src/fasta/colors.dart
@@ -98,7 +98,14 @@ String white(String string) => wrap(string, WHITE_COLOR);
/// Note: do not call this method directly, as it is expensive to
/// compute. Instead, use [CompilerContext.enableColors].
bool computeEnableColors(CompilerContext context) {
- if (!Platform.ansiSupported) {
+ bool ansiSupported;
+ try {
+ ansiSupported = Platform.ansiSupported;
+ } on NoSuchMethodError catch (e) {
+ // Ignored: We're running on an older version of the Dart VM which doesn't
+ // implement `ansiSupported`.
+ }
+ if (ansiSupported == false) {
if (context.options.verbose) {
print("Not enabling colors, 'Platform.ansiSupported' is false.");
}
@@ -119,7 +126,7 @@ bool computeEnableColors(CompilerContext context) {
return false;
}
- if (Platform.isWindows) {
+ if (ansiSupported == true && Platform.isWindows) {
if (context.options.verbose) {
print("Enabling colors as OS is Windows.");
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698