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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/kernel_target.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 side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index 3a43d7c656e416c4c2be20f8f56af905adf5f576..1072c0960fe4bc51ed42a0b09280071c08f6330b 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -75,6 +75,12 @@ import '../errors.dart' show
reportCrash,
resetCrashReporting;
+import '../util/relativize.dart' show
+ relativizeUri;
+
+import '../compiler_context.dart' show
+ CompilerContext;
+
import 'kernel_builder.dart' show
Builder,
ClassBuilder,
@@ -92,18 +98,29 @@ import 'kernel_builder.dart' show
class KernelTarget extends TargetImplementation {
final DillTarget dillTarget;
+
+ /// Shared with [CompilerContext].
+ final Map<String, Source> uriToSource;
+
SourceLoader<Library> loader;
Program program;
final List errors = [];
- KernelTarget(DillTarget dillTarget, TranslateUri uriTranslator)
+ KernelTarget(DillTarget dillTarget, TranslateUri uriTranslator,
+ [Map<String, Source> uriToSource])
: dillTarget = dillTarget,
+ uriToSource = uriToSource ?? CompilerContext.current.uriToSource,
super(dillTarget.ticker, uriTranslator) {
resetCrashReporting();
loader = new SourceLoader<Library>(this);
}
+ void addLineStarts(Uri uri, List<int> lineStarts) {
+ String fileUri = relativizeUri(uri);
+ uriToSource[fileUri] = new Source(lineStarts, fileUri);
+ }
+
void read(Uri uri) {
loader.read(uri);
}
@@ -317,7 +334,9 @@ class KernelTarget extends TargetImplementation {
program.mainMethod = builder.procedure;
}
}
- setup_builtin_library.transformProgram(program);
+ if (errors.isEmpty || dillTarget.isLoaded) {
+ setup_builtin_library.transformProgram(program);
+ }
ticker.logMs("Linked program");
return program;
}
« no previous file with comments | « pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart ('k') | pkg/front_end/lib/src/fasta/messages.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698