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

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

Issue 2874723002: Add a way to use shared CanonicalName root to deserialize Program. (Closed)
Patch Set: Always compute canonical names. Use shared name root. Created 3 years, 7 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
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library fasta.kernel_target; 5 library fasta.kernel_target;
6 6
7 import 'dart:async' show Future; 7 import 'dart:async' show Future;
8 8
9 import 'dart:io' show File, IOSink; 9 import 'dart:io' show File, IOSink;
10 10
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 library.build(loader.coreLibrary); 365 library.build(loader.coreLibrary);
366 return link(<Library>[library.library]); 366 return link(<Library>[library.library]);
367 } 367 }
368 368
369 /// Creates a program by combining [libraries] with the libraries of 369 /// Creates a program by combining [libraries] with the libraries of
370 /// `dillTarget.loader.program`. 370 /// `dillTarget.loader.program`.
371 Program link(List<Library> libraries) { 371 Program link(List<Library> libraries) {
372 Map<String, Source> uriToSource = 372 Map<String, Source> uriToSource =
373 new Map<String, Source>.from(this.uriToSource); 373 new Map<String, Source>.from(this.uriToSource);
374 374
375 final Program binary = dillTarget.loader.program; 375 libraries.addAll(dillTarget.loader.libraries);
376 if (binary != null) {
377 libraries.addAll(binary.libraries);
378 uriToSource.addAll(binary.uriToSource);
379 }
380 376
381 // TODO(ahe): Remove this line. Kernel seems to generate a default line map 377 // TODO(ahe): Remove this line. Kernel seems to generate a default line map
382 // that used when there's no fileUri on an element. Instead, ensure all 378 // that used when there's no fileUri on an element. Instead, ensure all
383 // elements have a fileUri. 379 // elements have a fileUri.
384 uriToSource[""] = new Source(<int>[0], const <int>[]); 380 uriToSource[""] = new Source(<int>[0], const <int>[]);
385 Program program = new Program(libraries, uriToSource); 381 Program program = new Program(
382 nameRoot: dillTarget.nameRoot,
Siggi Cherem (dart-lang) 2017/05/12 16:27:57 I think I don't have the full picture yet. I'm cu
scheglov 2017/05/12 17:15:16 Done.
383 libraries: libraries,
384 uriToSource: uriToSource);
386 if (loader.first != null) { 385 if (loader.first != null) {
387 Builder builder = loader.first.lookup("main", -1, null); 386 Builder builder = loader.first.lookup("main", -1, null);
388 if (builder is KernelProcedureBuilder) { 387 if (builder is KernelProcedureBuilder) {
389 program.mainMethod = builder.procedure; 388 program.mainMethod = builder.procedure;
390 } 389 }
391 } 390 }
392 if (errors.isEmpty || dillTarget.isLoaded) { 391 if (errors.isEmpty || dillTarget.isLoaded) {
393 runLinkTransformations(program); 392 runLinkTransformations(program);
394 } 393 }
395 ticker.logMs("Linked program"); 394 ticker.logMs("Linked program");
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
718 } 717 }
719 for (Constructor constructor in superclass.constructors) { 718 for (Constructor constructor in superclass.constructors) {
720 if (constructor.name.name.isEmpty) { 719 if (constructor.name.name.isEmpty) {
721 return constructor.function.requiredParameterCount == 0 720 return constructor.function.requiredParameterCount == 0
722 ? constructor 721 ? constructor
723 : null; 722 : null;
724 } 723 }
725 } 724 }
726 return null; 725 return null;
727 } 726 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698