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 fbb3a9abfbda5ef5f0d55414f527837d4a10b32f..4be81b7332951d2f609d1a8f4a711a73f26d3d81 100644 |
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart |
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart |
@@ -13,6 +13,7 @@ import 'package:kernel/ast.dart' |
show |
Arguments, |
AsyncMarker, |
+ CanonicalName, |
Class, |
Constructor, |
DartType, |
@@ -230,7 +231,7 @@ class KernelTarget extends TargetImplementation { |
: writeLinkedProgram(uri, program, isFullProgram: isFullProgram); |
} |
- Future<Program> writeOutline(Uri uri) async { |
+ Future<Program> writeOutline(Uri uri, {CanonicalName nameRoot}) async { |
if (loader.first == null) return null; |
try { |
loader.createTypeInferenceEngine(); |
@@ -248,7 +249,8 @@ class KernelTarget extends TargetImplementation { |
installDefaultConstructors(sourceClasses); |
loader.resolveConstructors(); |
loader.finishTypeVariables(objectClassBuilder); |
- program = link(new List<Library>.from(loader.libraries)); |
+ program = |
+ link(new List<Library>.from(loader.libraries), nameRoot: nameRoot); |
loader.computeHierarchy(program); |
loader.checkOverrides(sourceClasses); |
loader.prepareInitializerInference(); |
@@ -368,21 +370,20 @@ class KernelTarget extends TargetImplementation { |
/// Creates a program by combining [libraries] with the libraries of |
/// `dillTarget.loader.program`. |
- Program link(List<Library> libraries) { |
+ Program link(List<Library> libraries, {CanonicalName nameRoot}) { |
Map<String, Source> uriToSource = |
new Map<String, Source>.from(this.uriToSource); |
- final Program binary = dillTarget.loader.program; |
- if (binary != null) { |
- libraries.addAll(binary.libraries); |
- uriToSource.addAll(binary.uriToSource); |
- } |
+ libraries.addAll(dillTarget.loader.libraries); |
+ // TODO(scheglov) Should we also somehow update `uriToSource`? |
+// uriToSource.addAll(binary.uriToSource); |
ahe
2017/05/15 09:08:44
Yes. You need to update uriToSource. Otherwise the
|
// TODO(ahe): Remove this line. Kernel seems to generate a default line map |
// that used when there's no fileUri on an element. Instead, ensure all |
// elements have a fileUri. |
uriToSource[""] = new Source(<int>[0], const <int>[]); |
- Program program = new Program(libraries, uriToSource); |
+ Program program = new Program( |
+ nameRoot: nameRoot, libraries: libraries, uriToSource: uriToSource); |
if (loader.first != null) { |
Builder builder = loader.first.lookup("main", -1, null); |
if (builder is KernelProcedureBuilder) { |