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 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 return new TreeElementMapping(element); | 454 return new TreeElementMapping(element); |
455 } | 455 } |
456 if (element.isPatched) { | 456 if (element.isPatched) { |
457 checkMatchingPatchSignatures(element, element.patch); | 457 checkMatchingPatchSignatures(element, element.patch); |
458 element = element.patch; | 458 element = element.patch; |
459 } | 459 } |
460 return compiler.withCurrentElement(element, () { | 460 return compiler.withCurrentElement(element, () { |
461 FunctionExpression tree = element.parseNode(compiler); | 461 FunctionExpression tree = element.parseNode(compiler); |
462 if (tree.modifiers.isExternal()) { | 462 if (tree.modifiers.isExternal()) { |
463 error(tree, MessageKind.PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION); | 463 error(tree, MessageKind.PATCH_EXTERNAL_WITHOUT_IMPLEMENTATION); |
464 return; | 464 return null; |
465 } | 465 } |
466 if (isConstructor || element.isFactoryConstructor()) { | 466 if (isConstructor || element.isFactoryConstructor()) { |
467 if (tree.returnType != null) { | 467 if (tree.returnType != null) { |
468 error(tree, MessageKind.CONSTRUCTOR_WITH_RETURN_TYPE); | 468 error(tree, MessageKind.CONSTRUCTOR_WITH_RETURN_TYPE); |
469 } | 469 } |
470 if (element.modifiers.isConst() && | 470 if (element.modifiers.isConst() && |
471 tree.hasBody() && | 471 tree.hasBody() && |
472 !tree.isRedirectingFactory) { | 472 !tree.isRedirectingFactory) { |
473 compiler.reportError(tree, MessageKind.CONST_CONSTRUCTOR_HAS_BODY); | 473 compiler.reportError(tree, MessageKind.CONST_CONSTRUCTOR_HAS_BODY); |
474 } | 474 } |
(...skipping 2120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2595 } | 2595 } |
2596 } | 2596 } |
2597 | 2597 |
2598 if (!resolvedArguments) { | 2598 if (!resolvedArguments) { |
2599 resolveArguments(node.argumentsNode); | 2599 resolveArguments(node.argumentsNode); |
2600 } | 2600 } |
2601 | 2601 |
2602 // If the selector is null, it means that we will not be generating | 2602 // If the selector is null, it means that we will not be generating |
2603 // code for this as a send. | 2603 // code for this as a send. |
2604 Selector selector = mapping.getSelector(node); | 2604 Selector selector = mapping.getSelector(node); |
2605 if (selector == null) return; | 2605 if (selector == null) return null; |
2606 | 2606 |
2607 if (node.isCall) { | 2607 if (node.isCall) { |
2608 if (Elements.isUnresolved(target) || | 2608 if (Elements.isUnresolved(target) || |
2609 target.isGetter() || | 2609 target.isGetter() || |
2610 target.isField() || | 2610 target.isField() || |
2611 Elements.isClosureSend(node, target)) { | 2611 Elements.isClosureSend(node, target)) { |
2612 // If we don't know what we're calling or if we are calling a getter, | 2612 // If we don't know what we're calling or if we are calling a getter, |
2613 // we need to register that fact that we may be calling a closure | 2613 // we need to register that fact that we may be calling a closure |
2614 // with the same arguments. | 2614 // with the same arguments. |
2615 Selector call = new Selector.callClosureFrom(selector); | 2615 Selector call = new Selector.callClosureFrom(selector); |
(...skipping 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4681 return finishConstructorReference(visit(expression), | 4681 return finishConstructorReference(visit(expression), |
4682 expression, expression); | 4682 expression, expression); |
4683 } | 4683 } |
4684 } | 4684 } |
4685 | 4685 |
4686 /// Looks up [name] in [scope] and unwraps the result. | 4686 /// Looks up [name] in [scope] and unwraps the result. |
4687 Element lookupInScope(Compiler compiler, Node node, | 4687 Element lookupInScope(Compiler compiler, Node node, |
4688 Scope scope, String name) { | 4688 Scope scope, String name) { |
4689 return Elements.unwrap(scope.lookup(name), compiler, node); | 4689 return Elements.unwrap(scope.lookup(name), compiler, node); |
4690 } | 4690 } |
OLD | NEW |