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

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') | 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 a896995c3fefa1892d43c17421cce5ac131b485d..b036a5f4d92b7c6829faee917910054ff6936b84 100644
--- a/lib/compiler/implementation/dart_backend/backend.dart
+++ b/lib/compiler/implementation/dart_backend/backend.dart
@@ -131,34 +131,41 @@ bool isDartCoreLib(Compiler compiler, LibraryElement libraryElement) {
*/
class ReferencedElementCollector extends AbstractVisitor {
final Compiler compiler;
- final Element element;
+ final Element rootElement;
final TreeElements treeElements;
final Set<TypedefElement> typedefs;
final Set<ClassElement> classes;
ReferencedElementCollector(
this.compiler,
- this.element, this.treeElements,
+ this.rootElement, this.treeElements,
this.typedefs, this.classes);
+ void collectElement(Element element) {
+ new ReferencedElementCollector(
+ compiler, element, new TreeElementMapping(), typedefs, classes)
+ .collect();
+ }
+
visitNode(Node node) { node.visitChildren(this); }
visitTypeAnnotation(TypeAnnotation typeAnnotation) {
- final type = compiler.resolveTypeAnnotation(element, typeAnnotation);
+ final type = compiler.resolveTypeAnnotation(rootElement, typeAnnotation);
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);
}
void collect() {
- compiler.withCurrentElement(element, () {
- element.parseNode(compiler).accept(this);
+ compiler.withCurrentElement(rootElement, () {
+ rootElement.parseNode(compiler).accept(this);
});
}
}
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698