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

Unified Diff: pkg/kernel/lib/ast.dart

Issue 2874723002: Add a way to use shared CanonicalName root to deserialize Program. (Closed)
Patch Set: Actual changes. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/front_end/test/fasta/testing/suite.dart ('k') | pkg/kernel/lib/kernel.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/kernel/lib/ast.dart
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index f051b14ade22132f252350ab363b45c0099bf252..bbb714990cef81b28a087ae543e7f8b1e69c64b1 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -4216,7 +4216,7 @@ class Supertype extends Node {
/// A way to bundle up all the libraries in a program.
class Program extends TreeNode {
- final CanonicalName root = new CanonicalName.root();
+ final CanonicalName root;
Siggi Cherem (dart-lang) 2017/05/10 18:00:38 Question for Kevin on API design here: - should w
Kevin Millikin (Google) 2017/05/11 08:22:55 Even without these changes, Program is already not
final List<Library> libraries;
@@ -4228,14 +4228,19 @@ class Program extends TreeNode {
/// Reference to the main method in one of the libraries.
Reference mainMethodName;
- Program([List<Library> libraries, Map<String, Source> uriToSource])
- : libraries = libraries ?? <Library>[],
+ Program(
+ {CanonicalName nameRoot,
+ List<Library> libraries,
+ Map<String, Source> uriToSource})
+ : root = nameRoot ?? new CanonicalName.root(),
+ libraries = libraries ?? <Library>[],
uriToSource = uriToSource ?? <String, Source>{} {
setParents(this.libraries, this);
}
void computeCanonicalNames() {
for (var library in libraries) {
+ if (library.canonicalName != null) continue;
Kevin Millikin (Google) 2017/05/11 08:22:55 Keep in mind that this approach of skipping librar
scheglov 2017/05/11 18:31:25 OK, I rolled this back.
root.getChildFromUri(library.importUri).bindTo(library.reference);
library.computeCanonicalNames();
}
« no previous file with comments | « pkg/front_end/test/fasta/testing/suite.dart ('k') | pkg/kernel/lib/kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698