| 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 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 makeConstructorPlaceholder(node.send.selector, constructor, type); | 374 makeConstructorPlaceholder(node.send.selector, constructor, type); |
| 375 // TODO(smok): Should this be in visitNamedArgument? | 375 // TODO(smok): Should this be in visitNamedArgument? |
| 376 // Field names can be exposed as names of optional arguments, e.g. | 376 // Field names can be exposed as names of optional arguments, e.g. |
| 377 // class C { | 377 // class C { |
| 378 // final field; | 378 // final field; |
| 379 // C([this.field]); | 379 // C([this.field]); |
| 380 // } | 380 // } |
| 381 // Do not forget to rename them as well. | 381 // Do not forget to rename them as well. |
| 382 FunctionElement constructorFunction = constructor; | 382 FunctionElement constructorFunction = constructor; |
| 383 Link<Element> optionalParameters = | 383 Link<Element> optionalParameters = |
| 384 constructorFunction.functionSignature.optionalParameters; | 384 constructorFunction.computeSignature(compiler).optionalParameters; |
| 385 for (final argument in send.argumentsNode) { | 385 for (final argument in send.argumentsNode) { |
| 386 NamedArgument named = argument.asNamedArgument(); | 386 NamedArgument named = argument.asNamedArgument(); |
| 387 if (named == null) continue; | 387 if (named == null) continue; |
| 388 Identifier name = named.name; | 388 Identifier name = named.name; |
| 389 String nameAsString = name.source.slowToString(); | 389 String nameAsString = name.source.slowToString(); |
| 390 for (final parameter in optionalParameters) { | 390 for (final parameter in optionalParameters) { |
| 391 if (identical(parameter.kind, ElementKind.FIELD_PARAMETER)) { | 391 if (identical(parameter.kind, ElementKind.FIELD_PARAMETER)) { |
| 392 if (parameter.name.slowToString() == nameAsString) { | 392 if (parameter.name.slowToString() == nameAsString) { |
| 393 tryMakeMemberPlaceholder(name); | 393 tryMakeMemberPlaceholder(name); |
| 394 break; | 394 break; |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 | 615 |
| 616 visitBlock(Block node) { | 616 visitBlock(Block node) { |
| 617 for (Node statement in node.statements.nodes) { | 617 for (Node statement in node.statements.nodes) { |
| 618 if (statement is VariableDefinitions) { | 618 if (statement is VariableDefinitions) { |
| 619 makeVarDeclarationTypePlaceholder(statement); | 619 makeVarDeclarationTypePlaceholder(statement); |
| 620 } | 620 } |
| 621 } | 621 } |
| 622 node.visitChildren(this); | 622 node.visitChildren(this); |
| 623 } | 623 } |
| 624 } | 624 } |
| OLD | NEW |