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

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

Issue 10826259: Collect referenced classes recursively. (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/language/language.status » ('j') | tests/language/language.status » ('J')
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 a896995c3fefa1892d43c17421cce5ac131b485d..4569ff89aaa8ec21d39cfdb3bf551438a4d882fa 100644
--- a/lib/compiler/implementation/dart_backend/backend.dart
+++ b/lib/compiler/implementation/dart_backend/backend.dart
@@ -141,6 +141,12 @@ class ReferencedElementCollector extends AbstractVisitor {
this.element, this.treeElements,
this.typedefs, this.classes);
+ void collectElement(Element element) {
Anton Muhin 2012/08/13 08:15:30 nit: please, do not shadow the field.
Roman 2012/08/13 08:23:08 Renamed field to rootElement.
+ new ReferencedElementCollector(
+ compiler, element, new TreeElementMapping(), typedefs, classes)
+ .collect();
+ }
+
visitNode(Node node) { node.visitChildren(this); }
visitTypeAnnotation(TypeAnnotation typeAnnotation) {
@@ -148,11 +154,12 @@ class ReferencedElementCollector extends AbstractVisitor {
Element typeElement = type.element;
if (typeElement.isTypedef() && !typedefs.contains(typeElement)) {
typedefs.add(typeElement);
- new ReferencedElementCollector(
- compiler, typeElement, new TreeElementMapping(), typedefs, classes)
- .collect();
+ collectElement(typeElement);
+ }
+ if (typeElement.isClass() && !classes.contains(typeElement)) {
+ classes.add(typeElement);
+ collectElement(typeElement);
}
- if (typeElement.isClass()) classes.add(typeElement);
typeAnnotation.visitChildren(this);
}
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | tests/language/language.status » ('J')

Powered by Google App Engine
This is Rietveld 408576698