| 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 } | 612 } |
| 613 } | 613 } |
| 614 node.visitChildren(this); | 614 node.visitChildren(this); |
| 615 } | 615 } |
| 616 | 616 |
| 617 visitFunctionExpression(FunctionExpression node) { | 617 visitFunctionExpression(FunctionExpression node) { |
| 618 bool isKeyword(Identifier id) => | 618 bool isKeyword(Identifier id) => |
| 619 id != null && Keyword.keywords[id.source] != null; | 619 id != null && Keyword.keywords[id.source] != null; |
| 620 | 620 |
| 621 Element element = treeElements[node]; | 621 Element element = treeElements[node]; |
| 622 // May get null here in case of A(int this.f()); | 622 // May get null; |
| 623 if (element != null) { | 623 if (element != null) { |
| 624 tryMakePrivateIdentifier(node.name, element); | 624 tryMakePrivateIdentifier(node.name, element); |
| 625 | 625 |
| 626 // Rename only local functions. | 626 // Rename only local functions. |
| 627 if (topmostEnclosingFunction == null) { | 627 if (topmostEnclosingFunction == null && |
| 628 element is! LocalParameterElement && |
| 629 element is! InitializingFormalElement) { |
| 628 topmostEnclosingFunction = element; | 630 topmostEnclosingFunction = element; |
| 629 } | 631 } |
| 630 if (!identical(element, currentElement)) { | 632 if (!identical(element, currentElement)) { |
| 631 if (node.name != null) { | 633 if (node.name != null) { |
| 632 assert(node.name is Identifier); | 634 assert(node.name is Identifier); |
| 633 tryMakeLocalPlaceholder(element, node.name); | 635 tryMakeLocalPlaceholder(element, node.name); |
| 634 } | 636 } |
| 635 } | 637 } |
| 636 } | 638 } |
| 637 | 639 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 692 | 694 |
| 693 visitBlock(Block node) { | 695 visitBlock(Block node) { |
| 694 for (Node statement in node.statements.nodes) { | 696 for (Node statement in node.statements.nodes) { |
| 695 if (statement is VariableDefinitions) { | 697 if (statement is VariableDefinitions) { |
| 696 makeVarDeclarationTypePlaceholder(statement); | 698 makeVarDeclarationTypePlaceholder(statement); |
| 697 } | 699 } |
| 698 } | 700 } |
| 699 node.visitChildren(this); | 701 node.visitChildren(this); |
| 700 } | 702 } |
| 701 } | 703 } |
| OLD | NEW |