| 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 class LocalPlaceholder implements Hashable { | 5 class LocalPlaceholder implements Hashable { |
| 6 final String identifier; | 6 final String identifier; |
| 7 final Set<Node> nodes; | 7 final Set<Node> nodes; |
| 8 LocalPlaceholder(this.identifier) : nodes = new Set<Node>(); | 8 LocalPlaceholder(this.identifier) : nodes = new Set<Node>(); |
| 9 int hashCode() => identifier.hashCode(); | 9 int hashCode() => identifier.hashCode(); |
| 10 String toString() => | 10 String toString() => |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 visitGetterSend(Send node) { | 34 visitGetterSend(Send node) { |
| 35 final element = elements[node]; | 35 final element = elements[node]; |
| 36 // element === null means dynamic property access. | 36 // element === null means dynamic property access. |
| 37 if (element === null || element.isInstanceMember()) { | 37 if (element === null || element.isInstanceMember()) { |
| 38 tryRenamePrivateSelector(node); | 38 tryRenamePrivateSelector(node); |
| 39 return; | 39 return; |
| 40 } | 40 } |
| 41 // We don't want to rename non top-level element access | 41 // We don't want to rename non top-level element access |
| 42 // unless it's a local variable. | 42 // unless it's a local variable. |
| 43 if (!element.isTopLevel()) { | 43 if (element.isPrefix()) { |
| 44 // Node is prefix part in case of source 'lib.somesetter = 5;' |
| 45 collector.makeNullPlaceholder(node); |
| 46 return; |
| 47 } else if (!element.isTopLevel()) { |
| 44 // May get FunctionExpression here in selector | 48 // May get FunctionExpression here in selector |
| 45 // in case of A(int this.f()); | 49 // in case of A(int this.f()); |
| 46 if (node.selector is Identifier) { | 50 if (node.selector is Identifier) { |
| 47 collector.tryMakeLocalPlaceholder(element, node.selector); | 51 collector.tryMakeLocalPlaceholder(element, node.selector); |
| 48 } else { | 52 } else { |
| 49 assert(node.selector is FunctionExpression); | 53 assert(node.selector is FunctionExpression); |
| 50 } | 54 } |
| 51 return; | 55 return; |
| 52 } | 56 } |
| 53 // Unqualified <class> in static invocation, why it's not a type annotation? | 57 // Unqualified <class> in static invocation, why it's not a type annotation? |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 makeElementPlaceholder(node.name, currentElement); | 420 makeElementPlaceholder(node.name, currentElement); |
| 417 node.visitChildren(this); | 421 node.visitChildren(this); |
| 418 } | 422 } |
| 419 | 423 |
| 420 visitTypedef(Typedef node) { | 424 visitTypedef(Typedef node) { |
| 421 assert(currentElement is TypedefElement); | 425 assert(currentElement is TypedefElement); |
| 422 makeElementPlaceholder(node.name, currentElement); | 426 makeElementPlaceholder(node.name, currentElement); |
| 423 node.visitChildren(this); | 427 node.visitChildren(this); |
| 424 } | 428 } |
| 425 } | 429 } |
| OLD | NEW |