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

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

Issue 422483002: Mix in [TreeElementMixin] only on nodes that need it. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 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
Index: sdk/lib/_internal/compiler/implementation/dart_backend/placeholder_collector.dart
diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/placeholder_collector.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/placeholder_collector.dart
index d7279d54a7bfb622670c2808bc6e3187ce05b91b..40fb6ead72d6ee2d8d28cd5b9d8bb8efc818dff7 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_backend/placeholder_collector.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_backend/placeholder_collector.dart
@@ -195,14 +195,16 @@ class PlaceholderCollector extends Visitor {
ConstructorElement constructor = element;
DartType type = element.enclosingClass.thisType.asRaw();
makeConstructorPlaceholder(node.name, element, type);
- Return bodyAsReturn = node.body.asReturn();
- if (bodyAsReturn != null && bodyAsReturn.isRedirectingFactoryBody) {
+ RedirectingFactoryBody bodyAsRedirectingFactoryBody =
+ node.body.asRedirectingFactoryBody();
+ if (bodyAsRedirectingFactoryBody != null) {
// Factory redirection.
FunctionElement redirectTarget = constructor.immediateRedirectionTarget;
assert(redirectTarget != null && redirectTarget != element);
type = redirectTarget.enclosingClass.thisType.asRaw();
makeConstructorPlaceholder(
- bodyAsReturn.expression, redirectTarget, type);
+ bodyAsRedirectingFactoryBody.constructorReference,
+ redirectTarget, type);
}
} else if (Elements.isStaticOrTopLevel(element)) {
// Note: this code should only rename private identifiers for class'
@@ -239,11 +241,7 @@ class PlaceholderCollector extends Visitor {
} else if (element is VariableElement) {
VariableDefinitions definitions = elementNode;
Node definition = definitions.definitions.nodes.head;
- final definitionElement = treeElements[elementNode];
- // definitionElement == null if variable is actually unused.
- if (definitionElement != null) {
- collectFieldDeclarationPlaceholders(definitionElement, definition);
- }
+ collectFieldDeclarationPlaceholders(element, definition);
makeVarDeclarationTypePlaceholder(definitions);
} else {
assert(element is ClassElement || element is TypedefElement);
@@ -252,6 +250,9 @@ class PlaceholderCollector extends Visitor {
compiler.withCurrentElement(element, () {
elementNode.accept(this);
});
+ if (element == backend.mirrorHelperSymbolsMap) {
+ backend.registerMirrorHelperElement(element, elementNode);
+ }
}
// TODO(karlklose): should we create placeholders for these?
@@ -484,10 +485,6 @@ class PlaceholderCollector extends Visitor {
}
visitVariableDefinitions(VariableDefinitions node) {
- Element definitionElement = treeElements[node];
- if (definitionElement == backend.mirrorHelperSymbolsMap) {
- backend.registerMirrorHelperElement(definitionElement, node);
- }
// Collect only local placeholders.
for (Node definition in node.definitions.nodes) {
Element definitionElement = treeElements[definition];

Powered by Google App Engine
This is Rietveld 408576698