| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 part of dart_backend; | 5 part of dart_backend; |
| 6 | 6 |
| 7 class LocalPlaceholder { | 7 class LocalPlaceholder { |
| 8 final String identifier; | 8 final String identifier; |
| 9 final Set<Node> nodes; | 9 final Set<Node> nodes; |
| 10 LocalPlaceholder(this.identifier) : nodes = new Set<Node>(); | 10 LocalPlaceholder(this.identifier) : nodes = new Set<Node>(); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 visitTypeReferenceSend(Send node) { | 134 visitTypeReferenceSend(Send node) { |
| 135 collector.makeElementPlaceholder(node.selector, elements[node]); | 135 collector.makeElementPlaceholder(node.selector, elements[node]); |
| 136 } | 136 } |
| 137 } | 137 } |
| 138 | 138 |
| 139 class PlaceholderCollector extends Visitor { | 139 class PlaceholderCollector extends Visitor { |
| 140 final Compiler compiler; | 140 final Compiler compiler; |
| 141 final Set<String> fixedMemberNames; // member names which cannot be renamed. | 141 final Set<String> fixedMemberNames; // member names which cannot be renamed. |
| 142 final Map<Element, ElementAst> elementAsts; | 142 final Map<Element, ElementAst> elementAsts; |
| 143 final Set<Node> nullNodes; // Nodes that should not be in output. | 143 final Set<Node> nullNodes; // Nodes that should not be in output. |
| 144 final Set<Identifier> unresolvedNodes; | 144 final Set<Node> unresolvedNodes; |
| 145 final Map<Element, Set<Node>> elementNodes; | 145 final Map<Element, Set<Node>> elementNodes; |
| 146 final Map<FunctionElement, FunctionScope> functionScopes; | 146 final Map<FunctionElement, FunctionScope> functionScopes; |
| 147 final Map<LibraryElement, Set<Identifier>> privateNodes; | 147 final Map<LibraryElement, Set<Identifier>> privateNodes; |
| 148 final List<DeclarationTypePlaceholder> declarationTypePlaceholders; | 148 final List<DeclarationTypePlaceholder> declarationTypePlaceholders; |
| 149 final Map<String, Set<Identifier>> memberPlaceholders; | 149 final Map<String, Set<Identifier>> memberPlaceholders; |
| 150 final Map<Element, List<ConstructorPlaceholder>> constructorPlaceholders; | 150 final Map<Element, List<ConstructorPlaceholder>> constructorPlaceholders; |
| 151 Map<String, LocalPlaceholder> currentLocalPlaceholders; | 151 Map<String, LocalPlaceholder> currentLocalPlaceholders; |
| 152 Element currentElement; | 152 Element currentElement; |
| 153 FunctionElement topmostEnclosingFunction; | 153 FunctionElement topmostEnclosingFunction; |
| 154 TreeElements treeElements; | 154 TreeElements treeElements; |
| 155 | 155 |
| 156 LibraryElement get coreLibrary => compiler.coreLibrary; | 156 LibraryElement get coreLibrary => compiler.coreLibrary; |
| 157 FunctionElement get entryFunction => compiler.mainApp.find(Compiler.MAIN); | 157 FunctionElement get entryFunction => compiler.mainApp.find(Compiler.MAIN); |
| 158 | 158 |
| 159 get currentFunctionScope => functionScopes.putIfAbsent( | 159 get currentFunctionScope => functionScopes.putIfAbsent( |
| 160 topmostEnclosingFunction, () => new FunctionScope()); | 160 topmostEnclosingFunction, () => new FunctionScope()); |
| 161 | 161 |
| 162 PlaceholderCollector(this.compiler, this.fixedMemberNames, this.elementAsts) : | 162 PlaceholderCollector(this.compiler, this.fixedMemberNames, this.elementAsts) : |
| 163 nullNodes = new Set<Node>(), | 163 nullNodes = new Set<Node>(), |
| 164 unresolvedNodes = new Set<Identifier>(), | 164 unresolvedNodes = new Set<Node>(), |
| 165 elementNodes = new Map<Element, Set<Node>>(), | 165 elementNodes = new Map<Element, Set<Node>>(), |
| 166 functionScopes = new Map<FunctionElement, FunctionScope>(), | 166 functionScopes = new Map<FunctionElement, FunctionScope>(), |
| 167 privateNodes = new Map<LibraryElement, Set<Identifier>>(), | 167 privateNodes = new Map<LibraryElement, Set<Identifier>>(), |
| 168 declarationTypePlaceholders = new List<DeclarationTypePlaceholder>(), | 168 declarationTypePlaceholders = new List<DeclarationTypePlaceholder>(), |
| 169 memberPlaceholders = new Map<String, Set<Identifier>>(), | 169 memberPlaceholders = new Map<String, Set<Identifier>>(), |
| 170 constructorPlaceholders = | 170 constructorPlaceholders = |
| 171 new Map<Element, List<ConstructorPlaceholder>>(); | 171 new Map<Element, List<ConstructorPlaceholder>>(); |
| 172 | 172 |
| 173 void collectFunctionDeclarationPlaceholders( | 173 void collectFunctionDeclarationPlaceholders( |
| 174 FunctionElement element, FunctionExpression node) { | 174 FunctionElement element, FunctionExpression node) { |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 | 605 |
| 606 visitBlock(Block node) { | 606 visitBlock(Block node) { |
| 607 for (Node statement in node.statements.nodes) { | 607 for (Node statement in node.statements.nodes) { |
| 608 if (statement is VariableDefinitions) { | 608 if (statement is VariableDefinitions) { |
| 609 makeVarDeclarationTypePlaceholder(statement); | 609 makeVarDeclarationTypePlaceholder(statement); |
| 610 } | 610 } |
| 611 } | 611 } |
| 612 node.visitChildren(this); | 612 node.visitChildren(this); |
| 613 } | 613 } |
| 614 } | 614 } |
| OLD | NEW |