Chromium Code Reviews| 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 368 visit(Node node) => (node === null) ? null : node.accept(this); | 368 visit(Node node) => (node === null) ? null : node.accept(this); |
| 369 | 369 |
| 370 visitNode(Node node) { node.visitChildren(this); } // We must go deeper. | 370 visitNode(Node node) { node.visitChildren(this); } // We must go deeper. |
| 371 | 371 |
| 372 visitSend(Send send) { | 372 visitSend(Send send) { |
| 373 new SendVisitor(this, treeElements).visitSend(send); | 373 new SendVisitor(this, treeElements).visitSend(send); |
| 374 send.visitChildren(this); | 374 send.visitChildren(this); |
| 375 } | 375 } |
| 376 | 376 |
| 377 visitSendSet(SendSet send) { | 377 visitSendSet(SendSet send) { |
| 378 final element = treeElements[send]; | 378 Element element = treeElements[send]; |
| 379 if (!Elements.isUnresolved(element)) { | 379 if (Elements.isErroneousElement(element)) { |
| 380 // Complicated case: constructs like receiver.selector++ can resolve | |
| 381 // to ErroneousElement. Fortunately, receiver.selector still | |
| 382 // can be resoved via treeElements[send.selector], that's all | |
| 383 // that is needed to rename the construct properly. | |
| 384 element = treeElements[send.selector]; | |
| 385 } | |
| 386 if (element === null) { | |
| 387 if (send.receiver !== null) tryMakeMemberPlaceholder(send.selector); | |
| 388 } else if (!element.isErroneous()) { | |
| 380 if (Elements.isStaticOrTopLevel(element)) { | 389 if (Elements.isStaticOrTopLevel(element)) { |
| 381 assert(element is VariableElement || element.isSetter()); | |
|
Roman
2012/09/17 10:19:39
Maybe just add element.isGetter() to the assert? I
Anton Muhin
2012/09/17 14:13:06
Done.
| |
| 382 makeElementPlaceholder(send.selector, element); | 390 makeElementPlaceholder(send.selector, element); |
| 383 } else { | 391 } else { |
| 384 assert(send.selector is Identifier); | 392 assert(send.selector is Identifier); |
| 385 if (Elements.isInstanceField(element)) { | 393 if (Elements.isInstanceField(element)) { |
| 386 tryMakeMemberPlaceholder(send.selector); | 394 tryMakeMemberPlaceholder(send.selector); |
| 387 } else { | 395 } else { |
| 388 tryMakeLocalPlaceholder(element, send.selector); | 396 tryMakeLocalPlaceholder(element, send.selector); |
| 389 } | 397 } |
| 390 } | 398 } |
| 391 } else { | |
| 392 if (send.receiver !== null) { | |
| 393 tryMakeMemberPlaceholder(send.selector); | |
| 394 } | |
| 395 } | 399 } |
| 396 send.visitChildren(this); | 400 send.visitChildren(this); |
| 397 } | 401 } |
| 398 | 402 |
| 399 visitIdentifier(Identifier identifier) { | 403 visitIdentifier(Identifier identifier) { |
| 400 if (identifier.source.isPrivate()) makePrivateIdentifier(identifier); | 404 if (identifier.source.isPrivate()) makePrivateIdentifier(identifier); |
| 401 } | 405 } |
| 402 | 406 |
| 403 static bool isPlainTypeName(TypeAnnotation typeAnnotation) { | 407 static bool isPlainTypeName(TypeAnnotation typeAnnotation) { |
| 404 if (typeAnnotation.typeName is !Identifier) return false; | 408 if (typeAnnotation.typeName is !Identifier) return false; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 579 | 583 |
| 580 visitBlock(Block node) { | 584 visitBlock(Block node) { |
| 581 for (Node statement in node.statements.nodes) { | 585 for (Node statement in node.statements.nodes) { |
| 582 if (statement is VariableDefinitions) { | 586 if (statement is VariableDefinitions) { |
| 583 makeVarDeclarationTypePlaceholder(statement); | 587 makeVarDeclarationTypePlaceholder(statement); |
| 584 } | 588 } |
| 585 } | 589 } |
| 586 node.visitChildren(this); | 590 node.visitChildren(this); |
| 587 } | 591 } |
| 588 } | 592 } |
| OLD | NEW |