| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 functionScopes = new Map<FunctionElement, FunctionScope>(), | 167 functionScopes = new Map<FunctionElement, FunctionScope>(), |
| 168 privateNodes = new Map<LibraryElement, Set<Identifier>>(), | 168 privateNodes = new Map<LibraryElement, Set<Identifier>>(), |
| 169 declarationTypePlaceholders = new List<DeclarationTypePlaceholder>(), | 169 declarationTypePlaceholders = new List<DeclarationTypePlaceholder>(), |
| 170 memberPlaceholders = new Map<String, Set<Identifier>>(), | 170 memberPlaceholders = new Map<String, Set<Identifier>>(), |
| 171 constructorPlaceholders = | 171 constructorPlaceholders = |
| 172 new Map<Element, List<ConstructorPlaceholder>>(); | 172 new Map<Element, List<ConstructorPlaceholder>>(); |
| 173 | 173 |
| 174 void collectFunctionDeclarationPlaceholders( | 174 void collectFunctionDeclarationPlaceholders( |
| 175 FunctionElement element, FunctionExpression node) { | 175 FunctionElement element, FunctionExpression node) { |
| 176 if (element.isGenerativeConstructor() || element.isFactoryConstructor()) { | 176 if (element.isGenerativeConstructor() || element.isFactoryConstructor()) { |
| 177 DartType type = element.getEnclosingClass().type.asRaw(); | 177 DartType type = element.getEnclosingClass().thisType.asRaw(); |
| 178 makeConstructorPlaceholder(node.name, element, type); | 178 makeConstructorPlaceholder(node.name, element, type); |
| 179 Return bodyAsReturn = node.body.asReturn(); | 179 Return bodyAsReturn = node.body.asReturn(); |
| 180 if (bodyAsReturn != null && bodyAsReturn.isRedirectingFactoryBody) { | 180 if (bodyAsReturn != null && bodyAsReturn.isRedirectingFactoryBody) { |
| 181 // Factory redirection. | 181 // Factory redirection. |
| 182 FunctionElement redirectTarget = element.defaultImplementation; | 182 FunctionElement redirectTarget = element.defaultImplementation; |
| 183 assert(redirectTarget != null && redirectTarget != element); | 183 assert(redirectTarget != null && redirectTarget != element); |
| 184 type = redirectTarget.getEnclosingClass().type.asRaw(); | 184 type = redirectTarget.getEnclosingClass().thisType.asRaw(); |
| 185 makeConstructorPlaceholder( | 185 makeConstructorPlaceholder( |
| 186 bodyAsReturn.expression, redirectTarget, type); | 186 bodyAsReturn.expression, redirectTarget, type); |
| 187 } | 187 } |
| 188 } else if (Elements.isStaticOrTopLevel(element)) { | 188 } else if (Elements.isStaticOrTopLevel(element)) { |
| 189 // Note: this code should only rename private identifiers for class' | 189 // Note: this code should only rename private identifiers for class' |
| 190 // fields/getters/setters/methods. Top-level identifiers are renamed | 190 // fields/getters/setters/methods. Top-level identifiers are renamed |
| 191 // just to escape conflicts and that should be enough as we shouldn't | 191 // just to escape conflicts and that should be enough as we shouldn't |
| 192 // be able to resolve private identifiers for other libraries. | 192 // be able to resolve private identifiers for other libraries. |
| 193 makeElementPlaceholder(node.name, element); | 193 makeElementPlaceholder(node.name, element); |
| 194 } else if (element.isMember()) { | 194 } else if (element.isMember()) { |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 616 | 616 |
| 617 visitBlock(Block node) { | 617 visitBlock(Block node) { |
| 618 for (Node statement in node.statements.nodes) { | 618 for (Node statement in node.statements.nodes) { |
| 619 if (statement is VariableDefinitions) { | 619 if (statement is VariableDefinitions) { |
| 620 makeVarDeclarationTypePlaceholder(statement); | 620 makeVarDeclarationTypePlaceholder(statement); |
| 621 } | 621 } |
| 622 } | 622 } |
| 623 node.visitChildren(this); | 623 node.visitChildren(this); |
| 624 } | 624 } |
| 625 } | 625 } |
| OLD | NEW |