| 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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 topmostEnclosingFunction, () => new FunctionScope()); | 182 topmostEnclosingFunction, () => new FunctionScope()); |
| 183 | 183 |
| 184 PlaceholderCollector(this.listener, this.mirrorRenamer, | 184 PlaceholderCollector(this.listener, this.mirrorRenamer, |
| 185 this.fixedMemberNames, this.elementAsts, | 185 this.fixedMemberNames, this.elementAsts, |
| 186 this.mainFunction); | 186 this.mainFunction); |
| 187 | 187 |
| 188 void collectFunctionDeclarationPlaceholders( | 188 void collectFunctionDeclarationPlaceholders( |
| 189 FunctionElement element, FunctionExpression node) { | 189 FunctionElement element, FunctionExpression node) { |
| 190 if (element.isConstructor) { | 190 if (element.isConstructor) { |
| 191 ConstructorElement constructor = element; | 191 ConstructorElement constructor = element; |
| 192 DartType type = element.enclosingClass.thisType.asRaw(); | |
| 193 tryMakeConstructorPlaceholder(node.name, element); | 192 tryMakeConstructorPlaceholder(node.name, element); |
| 194 RedirectingFactoryBody bodyAsRedirectingFactoryBody = | 193 RedirectingFactoryBody bodyAsRedirectingFactoryBody = |
| 195 node.body.asRedirectingFactoryBody(); | 194 node.body.asRedirectingFactoryBody(); |
| 196 if (bodyAsRedirectingFactoryBody != null) { | 195 if (bodyAsRedirectingFactoryBody != null) { |
| 197 // Factory redirection. | 196 // Factory redirection. |
| 198 FunctionElement redirectTarget = constructor.immediateRedirectionTarget; | 197 FunctionElement redirectTarget = constructor.immediateRedirectionTarget; |
| 199 assert(redirectTarget != null && redirectTarget != element); | 198 assert(redirectTarget != null && redirectTarget != element); |
| 200 type = redirectTarget.enclosingClass.thisType.asRaw(); | |
| 201 tryMakeConstructorPlaceholder( | 199 tryMakeConstructorPlaceholder( |
| 202 bodyAsRedirectingFactoryBody.constructorReference, | 200 bodyAsRedirectingFactoryBody.constructorReference, |
| 203 redirectTarget); | 201 redirectTarget); |
| 204 } | 202 } |
| 205 } else if (Elements.isStaticOrTopLevel(element)) { | 203 } else if (Elements.isStaticOrTopLevel(element)) { |
| 206 // Note: this code should only rename private identifiers for class' | 204 // Note: this code should only rename private identifiers for class' |
| 207 // fields/getters/setters/methods. Top-level identifiers are renamed | 205 // fields/getters/setters/methods. Top-level identifiers are renamed |
| 208 // just to escape conflicts and that should be enough as we shouldn't | 206 // just to escape conflicts and that should be enough as we shouldn't |
| 209 // be able to resolve private identifiers for other libraries. | 207 // be able to resolve private identifiers for other libraries. |
| 210 makeElementPlaceholder(node.name, element); | 208 makeElementPlaceholder(node.name, element); |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 702 | 700 |
| 703 visitBlock(Block node) { | 701 visitBlock(Block node) { |
| 704 for (Node statement in node.statements.nodes) { | 702 for (Node statement in node.statements.nodes) { |
| 705 if (statement is VariableDefinitions) { | 703 if (statement is VariableDefinitions) { |
| 706 makeVarDeclarationTypePlaceholder(statement); | 704 makeVarDeclarationTypePlaceholder(statement); |
| 707 } | 705 } |
| 708 } | 706 } |
| 709 node.visitChildren(this); | 707 node.visitChildren(this); |
| 710 } | 708 } |
| 711 } | 709 } |
| OLD | NEW |