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 { | 5 class LocalPlaceholder { |
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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 // Complicated case: constructs like receiver.selector++ can resolve | 387 // Complicated case: constructs like receiver.selector++ can resolve |
388 // to ErroneousElement. Fortunately, receiver.selector still | 388 // to ErroneousElement. Fortunately, receiver.selector still |
389 // can be resoved via treeElements[send.selector], that's all | 389 // can be resoved via treeElements[send.selector], that's all |
390 // that is needed to rename the construct properly. | 390 // that is needed to rename the construct properly. |
391 element = treeElements[send.selector]; | 391 element = treeElements[send.selector]; |
392 } | 392 } |
393 if (element === null) { | 393 if (element === null) { |
394 if (send.receiver !== null) tryMakeMemberPlaceholder(send.selector); | 394 if (send.receiver !== null) tryMakeMemberPlaceholder(send.selector); |
395 } else if (!element.isErroneous()) { | 395 } else if (!element.isErroneous()) { |
396 if (Elements.isStaticOrTopLevel(element)) { | 396 if (Elements.isStaticOrTopLevel(element)) { |
397 assert(element is VariableElement || element.isAccessor()); | 397 // TODO(smok): Worth investigating why sometimes we get getter/setter |
| 398 // here and sometimes abstract field. |
| 399 assert(element is VariableElement || element.isAccessor() |
| 400 || element.isAbstractField() || element.isFunction()); |
398 makeElementPlaceholder(send.selector, element); | 401 makeElementPlaceholder(send.selector, element); |
399 } else { | 402 } else { |
400 assert(send.selector is Identifier); | 403 assert(send.selector is Identifier); |
401 if (Elements.isInstanceField(element)) { | 404 if (Elements.isInstanceField(element)) { |
402 tryMakeMemberPlaceholder(send.selector); | 405 tryMakeMemberPlaceholder(send.selector); |
403 } else { | 406 } else { |
404 tryMakeLocalPlaceholder(element, send.selector); | 407 tryMakeLocalPlaceholder(element, send.selector); |
405 } | 408 } |
406 } | 409 } |
407 } | 410 } |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 | 635 |
633 visitBlock(Block node) { | 636 visitBlock(Block node) { |
634 for (Node statement in node.statements.nodes) { | 637 for (Node statement in node.statements.nodes) { |
635 if (statement is VariableDefinitions) { | 638 if (statement is VariableDefinitions) { |
636 makeVarDeclarationTypePlaceholder(statement); | 639 makeVarDeclarationTypePlaceholder(statement); |
637 } | 640 } |
638 } | 641 } |
639 node.visitChildren(this); | 642 node.visitChildren(this); |
640 } | 643 } |
641 } | 644 } |
OLD | NEW |