| 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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 } else if (!element.isErroneous()) { | 416 } else if (!element.isErroneous()) { |
| 417 if (Elements.isStaticOrTopLevel(element)) { | 417 if (Elements.isStaticOrTopLevel(element)) { |
| 418 // TODO(smok): Worth investigating why sometimes we get getter/setter | 418 // TODO(smok): Worth investigating why sometimes we get getter/setter |
| 419 // here and sometimes abstract field. | 419 // here and sometimes abstract field. |
| 420 assert(element.isClass() || element is VariableElement || | 420 assert(element.isClass() || element is VariableElement || |
| 421 element.isAccessor() || element.isAbstractField() || | 421 element.isAccessor() || element.isAbstractField() || |
| 422 element.isFunction() || element.isTypedef() || | 422 element.isFunction() || element.isTypedef() || |
| 423 element is TypeVariableElement); | 423 element is TypeVariableElement); |
| 424 makeElementPlaceholder(send.selector, element); | 424 makeElementPlaceholder(send.selector, element); |
| 425 } else { | 425 } else { |
| 426 assert(send.selector is Identifier); | 426 Identifier identifier = send.selector.asIdentifier(); |
| 427 if (identifier == null) { |
| 428 // Handle optional function expression parameters with default values. |
| 429 identifier = send.selector.asFunctionExpression().name; |
| 430 } |
| 427 if (Elements.isInstanceField(element)) { | 431 if (Elements.isInstanceField(element)) { |
| 428 tryMakeMemberPlaceholder(send.selector); | 432 tryMakeMemberPlaceholder(identifier); |
| 429 } else { | 433 } else { |
| 430 tryMakeLocalPlaceholder(element, send.selector); | 434 tryMakeLocalPlaceholder(element, identifier); |
| 431 } | 435 } |
| 432 } | 436 } |
| 433 } | 437 } |
| 434 send.visitChildren(this); | 438 send.visitChildren(this); |
| 435 } | 439 } |
| 436 | 440 |
| 437 visitIdentifier(Identifier identifier) { | 441 visitIdentifier(Identifier identifier) { |
| 438 if (identifier.source.isPrivate()) makePrivateIdentifier(identifier); | 442 if (identifier.source.isPrivate()) makePrivateIdentifier(identifier); |
| 439 } | 443 } |
| 440 | 444 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 | 626 |
| 623 visitBlock(Block node) { | 627 visitBlock(Block node) { |
| 624 for (Node statement in node.statements.nodes) { | 628 for (Node statement in node.statements.nodes) { |
| 625 if (statement is VariableDefinitions) { | 629 if (statement is VariableDefinitions) { |
| 626 makeVarDeclarationTypePlaceholder(statement); | 630 makeVarDeclarationTypePlaceholder(statement); |
| 627 } | 631 } |
| 628 } | 632 } |
| 629 node.visitChildren(this); | 633 node.visitChildren(this); |
| 630 } | 634 } |
| 631 } | 635 } |
| OLD | NEW |