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

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

Issue 10824329: dart2dart properly collect top level fields (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/placeholder_collector.dart
diff --git a/lib/compiler/implementation/dart_backend/placeholder_collector.dart b/lib/compiler/implementation/dart_backend/placeholder_collector.dart
index b6318b8a27a610c9b284958d94d1cbffe5b0fa0d..84a5e5b2160e479d25d8be15f549f9eefd3ea5dd 100644
--- a/lib/compiler/implementation/dart_backend/placeholder_collector.dart
+++ b/lib/compiler/implementation/dart_backend/placeholder_collector.dart
@@ -175,6 +175,15 @@ class PlaceholderCollector extends AbstractVisitor {
internalError('Unreachable case');
}
}
+ } else if (element.isTopLevel()) {
+ Node fieldNode = element.parseNode(compiler);
+ if (fieldNode is Identifier) {
+ makeElementPlaceholder(fieldNode, element);
+ } else if (fieldNode is SendSet) {
+ makeElementPlaceholder(fieldNode.selector, element);
+ } else {
+ internalError('Unreachable case');
+ }
}
}
@@ -190,6 +199,8 @@ class PlaceholderCollector extends AbstractVisitor {
// variable list element twice, better merge this with emitter logic.
currentElement = (element as VariableElement).variables;
elementNode = currentElement.parseNode(compiler);
+ // We don't collect other elements from the same variable lists
+ // if they are not used. http://dartbug.com/4536
collectFieldDeclarationPlaceholders(element, elementNode);
} else if (element is ClassElement || element is TypedefElement) {
currentElement = element;
« 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