| 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 resolution; | 5 part of resolution; |
| 6 | 6 |
| 7 abstract class TreeElements { | 7 abstract class TreeElements { |
| 8 Element get currentElement; | 8 Element get currentElement; |
| 9 Setlet<Node> get superUses; | 9 Setlet<Node> get superUses; |
| 10 | 10 |
| (...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1461 } | 1461 } |
| 1462 }); | 1462 }); |
| 1463 | 1463 |
| 1464 if (functionNode.initializers == null) { | 1464 if (functionNode.initializers == null) { |
| 1465 initializers = const Link<Node>(); | 1465 initializers = const Link<Node>(); |
| 1466 } else { | 1466 } else { |
| 1467 initializers = functionNode.initializers.nodes; | 1467 initializers = functionNode.initializers.nodes; |
| 1468 } | 1468 } |
| 1469 FunctionElement result; | 1469 FunctionElement result; |
| 1470 bool resolvedSuper = false; | 1470 bool resolvedSuper = false; |
| 1471 for (Link<Node> link = initializers; | 1471 for (Link<Node> link = initializers; !link.isEmpty; link = link.tail) { |
| 1472 !link.isEmpty; | |
| 1473 link = link.tail) { | |
| 1474 if (link.head.asSendSet() != null) { | 1472 if (link.head.asSendSet() != null) { |
| 1475 final SendSet init = link.head.asSendSet(); | 1473 final SendSet init = link.head.asSendSet(); |
| 1476 resolveFieldInitializer(constructor, init); | 1474 resolveFieldInitializer(constructor, init); |
| 1477 } else if (link.head.asSend() != null) { | 1475 } else if (link.head.asSend() != null) { |
| 1478 final Send call = link.head.asSend(); | 1476 final Send call = link.head.asSend(); |
| 1477 if (call.argumentsNode == null) { |
| 1478 error(link.head, MessageKind.INVALID_INITIALIZER); |
| 1479 continue; |
| 1480 } |
| 1479 if (Initializers.isSuperConstructorCall(call)) { | 1481 if (Initializers.isSuperConstructorCall(call)) { |
| 1480 if (resolvedSuper) { | 1482 if (resolvedSuper) { |
| 1481 error(call, MessageKind.DUPLICATE_SUPER_INITIALIZER); | 1483 error(call, MessageKind.DUPLICATE_SUPER_INITIALIZER); |
| 1482 } | 1484 } |
| 1483 resolveSuperOrThisForSend(constructor, functionNode, call); | 1485 resolveSuperOrThisForSend(constructor, functionNode, call); |
| 1484 resolvedSuper = true; | 1486 resolvedSuper = true; |
| 1485 } else if (Initializers.isConstructorRedirect(call)) { | 1487 } else if (Initializers.isConstructorRedirect(call)) { |
| 1486 // Check that there is no body (Language specification 7.5.1). If the | 1488 // Check that there is no body (Language specification 7.5.1). If the |
| 1487 // constructor is also const, we already reported an error in | 1489 // constructor is also const, we already reported an error in |
| 1488 // [resolveMethodElement]. | 1490 // [resolveMethodElement]. |
| (...skipping 3286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4775 return finishConstructorReference(visit(expression), | 4777 return finishConstructorReference(visit(expression), |
| 4776 expression, expression); | 4778 expression, expression); |
| 4777 } | 4779 } |
| 4778 } | 4780 } |
| 4779 | 4781 |
| 4780 /// Looks up [name] in [scope] and unwraps the result. | 4782 /// Looks up [name] in [scope] and unwraps the result. |
| 4781 Element lookupInScope(Compiler compiler, Node node, | 4783 Element lookupInScope(Compiler compiler, Node node, |
| 4782 Scope scope, String name) { | 4784 Scope scope, String name) { |
| 4783 return Elements.unwrap(scope.lookup(name), compiler, node); | 4785 return Elements.unwrap(scope.lookup(name), compiler, node); |
| 4784 } | 4786 } |
| OLD | NEW |