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

Unified Diff: lib/compiler/implementation/dart_backend/backend.dart

Issue 10837289: Split collecting and traversing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | « no previous file | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/dart_backend/backend.dart
diff --git a/lib/compiler/implementation/dart_backend/backend.dart b/lib/compiler/implementation/dart_backend/backend.dart
index 8ec60cc3bdf2b00b230b8de8077126968eecaf2f..e65c90bd669691f7233abee768bbdbf5e6ead6ee 100644
--- a/lib/compiler/implementation/dart_backend/backend.dart
+++ b/lib/compiler/implementation/dart_backend/backend.dart
@@ -38,11 +38,10 @@ class DartBackend extends Backend {
Map<ClassElement, Set<Element>> classMembers =
new Map<ClassElement, Set<Element>>();
- PlaceholderCollector collector = new PlaceholderCollector(compiler);
+ // Build all top level elements to emit and necessary class members.
var newTypedefElementCallback, newClassElementCallback;
processElement(element, treeElements) {
- collector.collect(element, treeElements);
new ReferencedElementCollector(
compiler,
element, treeElements,
@@ -87,6 +86,19 @@ class DartBackend extends Backend {
}
});
+ // Create all necessary placeholders.
+ PlaceholderCollector collector = new PlaceholderCollector(compiler);
+ makePlaceholders(element) {
+ TreeElements treeElements = resolvedElements[element];
+ if (treeElements === null) treeElements = emptyTreeElements;
+ collector.collect(element, treeElements);
+ if (element is ClassElement) {
+ classMembers[element].forEach(makePlaceholders);
+ }
+ }
+ topLevelElements.forEach(makePlaceholders);
+
+ // Create renames.
Map<Node, String> renames = new Map<Node, String>();
Map<LibraryElement, String> imports = new Map<LibraryElement, String>();
renamePlaceholders(compiler, collector, renames, imports);
« no previous file with comments | « no previous file | tests/compiler/dart2js/unparser_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698