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

Side by Side Diff: pkg/front_end/lib/src/fasta/compiler_context.dart

Issue 2704753002: Implement line and column numbers. (Closed)
Patch Set: Change message. Created 3 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file.
4
5 library fasta.compiler_context;
6
7 import 'dart:async' show
8 Zone,
9 runZoned;
10
11 import 'package:kernel/ast.dart' show
12 Source;
13
14 import 'compiler_command_line.dart' show
15 CompilerCommandLine;
16
17 final Object compilerContextKey = new Object();
18
19 final CompilerContext rootContext =
20 new CompilerContext(CompilerCommandLine.forRootContext());
21
22 class CompilerContext {
23 final CompilerCommandLine options;
24
25 final Map<String, Source> uriToSource = <String, Source>{};
26
27 CompilerContext(this.options);
28
29 static CompilerContext get current {
30 return Zone.current[compilerContextKey] ?? rootContext;
31 }
32
33 /// Perform [action] in a [Zone] where [cl] will be available as
34 /// `CompilerContext.current.options`.
35 static dynamic withGlobalOptions(CompilerCommandLine cl,
36 dynamic action(CompilerContext c)) {
37 CompilerContext c = new CompilerContext(cl);
38 return runZoned(() => action(c), zoneValues: {compilerContextKey: c});
39 }
40 }
OLDNEW
« no previous file with comments | « pkg/front_end/lib/src/fasta/compiler_command_line.dart ('k') | pkg/front_end/lib/src/fasta/dill/dill_target.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698