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 2f427eaeb826a07ac60960659e58b074187f1cf1..466ecdf1b92149954a012193721704abaa5220bb 100644 |
--- a/pkg/front_end/lib/src/fasta/compiler_context.dart |
+++ b/pkg/front_end/lib/src/fasta/compiler_context.dart |
@@ -8,6 +8,7 @@ import 'dart:async' show Zone, runZoned; |
import 'package:front_end/file_system.dart'; |
import 'package:front_end/physical_file_system.dart'; |
+import 'package:front_end/src/fasta/fasta_codes.dart'; |
import 'package:kernel/ast.dart' show Source; |
import 'compiler_command_line.dart' show CompilerCommandLine; |
@@ -20,9 +21,6 @@ import 'severity.dart' show Severity; |
final Object compilerContextKey = new Object(); |
-final CompilerContext rootContext = |
- new CompilerContext(CompilerCommandLine.forRootContext()); |
- |
class CompilerContext { |
final FileSystem fileSystem = PhysicalFileSystem.instance; |
@@ -59,7 +57,15 @@ class CompilerContext { |
} |
static CompilerContext get current { |
- return Zone.current[compilerContextKey] ?? rootContext; |
+ var context = Zone.current[compilerContextKey]; |
+ if (context == null) { |
+ // Note: we throw directly and don't use internalProblem, because |
+ // internalProblem depends on having a compiler context available. |
+ var message = messageInternalProblemMissingContext.message; |
+ var tip = messageInternalProblemMissingContext.tip; |
+ throw "Internal problem: $message\nTip: $tip"; |
+ } |
+ return context; |
} |
/// Perform [action] in a [Zone] where [cl] will be available as |