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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 348 |
349 visitNode(Node node) { node.visitChildren(this); } // We must go deeper. | 349 visitNode(Node node) { node.visitChildren(this); } // We must go deeper. |
350 | 350 |
351 visitNewExpression(NewExpression node) { | 351 visitNewExpression(NewExpression node) { |
352 Send send = node.send; | 352 Send send = node.send; |
353 InterfaceType type = treeElements.getType(node); | 353 InterfaceType type = treeElements.getType(node); |
354 assert(type != null); | 354 assert(type != null); |
355 Element constructor = treeElements[send]; | 355 Element constructor = treeElements[send]; |
356 assert(constructor != null); | 356 assert(constructor != null); |
357 assert(send.receiver == null); | 357 assert(send.receiver == null); |
358 if (constructor is !ErroneousElement) { | 358 if (!Elements.isErroneousElement(constructor) && |
| 359 !Elements.isMalformedElement(constructor)) { |
359 makeConstructorPlaceholder(node.send.selector, constructor, type); | 360 makeConstructorPlaceholder(node.send.selector, constructor, type); |
360 // TODO(smok): Should this be in visitNamedArgument? | 361 // TODO(smok): Should this be in visitNamedArgument? |
361 // Field names can be exposed as names of optional arguments, e.g. | 362 // Field names can be exposed as names of optional arguments, e.g. |
362 // class C { | 363 // class C { |
363 // final field; | 364 // final field; |
364 // C([this.field]); | 365 // C([this.field]); |
365 // } | 366 // } |
366 // Do not forget to rename them as well. | 367 // Do not forget to rename them as well. |
367 FunctionElement constructorFunction = constructor; | 368 FunctionElement constructorFunction = constructor; |
368 Link<Element> optionalParameters = | 369 Link<Element> optionalParameters = |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
605 | 606 |
606 visitBlock(Block node) { | 607 visitBlock(Block node) { |
607 for (Node statement in node.statements.nodes) { | 608 for (Node statement in node.statements.nodes) { |
608 if (statement is VariableDefinitions) { | 609 if (statement is VariableDefinitions) { |
609 makeVarDeclarationTypePlaceholder(statement); | 610 makeVarDeclarationTypePlaceholder(statement); |
610 } | 611 } |
611 } | 612 } |
612 node.visitChildren(this); | 613 node.visitChildren(this); |
613 } | 614 } |
614 } | 615 } |
OLD | NEW |