Chromium Code Reviews| 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..1d3a67d209180c53e1166ac5c038c32b43254c4d 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 "$message\nTip: $tip"; |
|
ahe
2017/07/17 08:42:07
Add prefix:
Internal problem:
Siggi Cherem (dart-lang)
2017/07/17 20:18:38
Done.
|
| + } |
| + return context; |
| } |
| /// Perform [action] in a [Zone] where [cl] will be available as |