| 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 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 462 |
| 463 visitNode(Node node) { node.visitChildren(this); } // We must go deeper. | 463 visitNode(Node node) { node.visitChildren(this); } // We must go deeper. |
| 464 | 464 |
| 465 visitNewExpression(NewExpression node) { | 465 visitNewExpression(NewExpression node) { |
| 466 Send send = node.send; | 466 Send send = node.send; |
| 467 DartType type = treeElements.getType(node); | 467 DartType type = treeElements.getType(node); |
| 468 assert(type != null); | 468 assert(type != null); |
| 469 Element constructor = treeElements[send]; | 469 Element constructor = treeElements[send]; |
| 470 assert(constructor != null); | 470 assert(constructor != null); |
| 471 assert(send.receiver == null); | 471 assert(send.receiver == null); |
| 472 if (!Elements.isErroneousElement(constructor)) { | 472 if (!Elements.isErroneous(constructor)) { |
| 473 tryMakeConstructorPlaceholder(node.send.selector, constructor); | 473 tryMakeConstructorPlaceholder(node.send.selector, constructor); |
| 474 // TODO(smok): Should this be in visitNamedArgument? | 474 // TODO(smok): Should this be in visitNamedArgument? |
| 475 // Field names can be exposed as names of optional arguments, e.g. | 475 // Field names can be exposed as names of optional arguments, e.g. |
| 476 // class C { | 476 // class C { |
| 477 // final field; | 477 // final field; |
| 478 // C([this.field]); | 478 // C([this.field]); |
| 479 // } | 479 // } |
| 480 // Do not forget to rename them as well. | 480 // Do not forget to rename them as well. |
| 481 FunctionElement constructorFunction = constructor; | 481 FunctionElement constructorFunction = constructor; |
| 482 Link<Element> optionalParameters = | 482 Link<Element> optionalParameters = |
| (...skipping 20 matching lines...) Expand all Loading... |
| 503 | 503 |
| 504 visitSend(Send send) { | 504 visitSend(Send send) { |
| 505 Element element = treeElements[send]; | 505 Element element = treeElements[send]; |
| 506 tryMakePrivateIdentifier(send.selector, element); | 506 tryMakePrivateIdentifier(send.selector, element); |
| 507 new SendVisitor(this, treeElements).visitSend(send); | 507 new SendVisitor(this, treeElements).visitSend(send); |
| 508 send.visitChildren(this); | 508 send.visitChildren(this); |
| 509 } | 509 } |
| 510 | 510 |
| 511 visitSendSet(SendSet send) { | 511 visitSendSet(SendSet send) { |
| 512 Element element = treeElements[send]; | 512 Element element = treeElements[send]; |
| 513 if (Elements.isErroneousElement(element)) { | 513 if (Elements.isErroneous(element)) { |
| 514 // Complicated case: constructs like receiver.selector++ can resolve | 514 // Complicated case: constructs like receiver.selector++ can resolve |
| 515 // to ErroneousElement. Fortunately, receiver.selector still | 515 // to ErroneousElement. Fortunately, receiver.selector still |
| 516 // can be resoved via treeElements[send.selector], that's all | 516 // can be resoved via treeElements[send.selector], that's all |
| 517 // that is needed to rename the construct properly. | 517 // that is needed to rename the construct properly. |
| 518 element = treeElements[send.selector]; | 518 element = treeElements[send.selector]; |
| 519 } | 519 } |
| 520 tryMakePrivateIdentifier(send.selector, element); | 520 tryMakePrivateIdentifier(send.selector, element); |
| 521 if (element == null) { | 521 if (element == null) { |
| 522 if (send.receiver != null) tryMakeMemberPlaceholder(send.selector); | 522 if (send.receiver != null) tryMakeMemberPlaceholder(send.selector); |
| 523 } else if (!element.isErroneous) { | 523 } else if (!element.isErroneous) { |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 | 694 |
| 695 visitBlock(Block node) { | 695 visitBlock(Block node) { |
| 696 for (Node statement in node.statements.nodes) { | 696 for (Node statement in node.statements.nodes) { |
| 697 if (statement is VariableDefinitions) { | 697 if (statement is VariableDefinitions) { |
| 698 makeVarDeclarationTypePlaceholder(statement); | 698 makeVarDeclarationTypePlaceholder(statement); |
| 699 } | 699 } |
| 700 } | 700 } |
| 701 node.visitChildren(this); | 701 node.visitChildren(this); |
| 702 } | 702 } |
| 703 } | 703 } |
| OLD | NEW |