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

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

Issue 10919127: Introduce AST cloning. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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: 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 39130b0952d8e7c7ca934da43b795ed581e4ed3c..b0131c6890f591261de77574054e448e0bbd7f52 100644
--- a/lib/compiler/implementation/dart_backend/placeholder_collector.dart
+++ b/lib/compiler/implementation/dart_backend/placeholder_collector.dart
@@ -133,6 +133,7 @@ class SendVisitor extends ResolvedVisitor {
class PlaceholderCollector extends AbstractVisitor {
final Compiler compiler;
final Set<String> fixedMemberNames; // member names which cannot be renamed.
+ final Map<Element, ElementAst> elementAsts;
final Set<Node> nullNodes; // Nodes that should not be in output.
final Set<Identifier> unresolvedNodes;
final Map<Element, Set<Node>> elementNodes;
@@ -147,7 +148,7 @@ class PlaceholderCollector extends AbstractVisitor {
LibraryElement get coreLibrary => compiler.coreLibrary;
FunctionElement get entryFunction => compiler.mainApp.find(Compiler.MAIN);
- PlaceholderCollector(this.compiler, this.fixedMemberNames) :
+ PlaceholderCollector(this.compiler, this.fixedMemberNames, this.elementAsts) :
nullNodes = new Set<Node>(),
unresolvedNodes = new Set<Identifier>(),
elementNodes = new Map<Element, Set<Node>>(),
@@ -197,8 +198,11 @@ class PlaceholderCollector extends AbstractVisitor {
if (element.defaultImplementation !== null
&& element.defaultImplementation !== element) {
FunctionElement implementingFactory = element.defaultImplementation;
- tryMakeConstructorNamePlaceholder(implementingFactory.cachedNode,
- element.getEnclosingClass());
+ if (implementingFactory is !SynthesizedConstructorElement) {
Roman 2012/09/07 08:10:56 Why this check? If it fixes something, please add
Anton Muhin 2012/09/07 12:26:07 This is somewhat related as we started to drop syn
+ tryMakeConstructorNamePlaceholder(
+ elementAsts[implementingFactory].ast,
+ element.getEnclosingClass());
+ }
}
} else if (Elements.isStaticOrTopLevel(element)) {
// Note: this code should only rename private identifiers for class'
@@ -224,16 +228,17 @@ class PlaceholderCollector extends AbstractVisitor {
}
}
- void collect(Element element, TreeElements elements) {
- treeElements = elements;
- currentElement = element;
- Node elementNode = currentElement.parseNode(compiler);
+ void collect(Element element) {
+ this.currentElement = element;
+ final ElementAst elementAst = elementAsts[element];
+ this.treeElements = elementAst.treeElements;
+ Node elementNode = elementAst.ast;
if (element is FunctionElement) {
collectFunctionDeclarationPlaceholders(element, elementNode);
} else if (element is VariableListElement) {
VariableDefinitions definitions = elementNode;
for (Node definition in definitions.definitions) {
- final definitionElement = elements[definition];
+ final definitionElement = treeElements[definition];
// definitionElement === null if variable is actually unused.
if (definitionElement === null) continue;
collectFieldDeclarationPlaceholders(definitionElement, definition);

Powered by Google App Engine
This is Rietveld 408576698