Chromium Code Reviews| 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 abstract class TreeElements { | 5 abstract class TreeElements { |
| 6 Element operator[](Node node); | 6 Element operator[](Node node); |
| 7 Selector getSelector(Send send); | 7 Selector getSelector(Send send); |
| 8 DartType getType(Node node); | 8 DartType getType(Node node); |
| 9 bool isParameterChecked(Element element); | 9 bool isParameterChecked(Element element); |
| 10 } | 10 } |
| (...skipping 1681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1692 // we need to register that fact that we may be calling a closure | 1692 // we need to register that fact that we may be calling a closure |
| 1693 // with the same arguments. | 1693 // with the same arguments. |
| 1694 if (node.isCall && | 1694 if (node.isCall && |
| 1695 (Elements.isUnresolved(target) || | 1695 (Elements.isUnresolved(target) || |
| 1696 target.isGetter() || | 1696 target.isGetter() || |
| 1697 Elements.isClosureSend(node, target))) { | 1697 Elements.isClosureSend(node, target))) { |
| 1698 Selector call = new Selector.callClosureFrom(selector); | 1698 Selector call = new Selector.callClosureFrom(selector); |
| 1699 world.registerDynamicInvocation(call.name, call); | 1699 world.registerDynamicInvocation(call.name, call); |
| 1700 } | 1700 } |
| 1701 | 1701 |
| 1702 if (!Elements.isUnresolved(target) | |
| 1703 && (target.kind == ElementKind.FUNCTION | |
| 1704 || target.kind == ElementKind.GENERATIVE_CONSTRUCTOR) | |
|
ngeoffray
2012/10/25 11:24:09
Why do you need these kind checks?
karlklose
2012/10/25 13:55:44
I need to be able to compute the signature for the
| |
| 1705 && !selector.applies(target, compiler)) { | |
| 1706 // TODO(karlklose): we can be more precise about the reason of the | |
| 1707 // mismatch. | |
| 1708 warning(node, MessageKind.INVALID_ARGUMENTS, [target.name]); | |
| 1709 } | |
| 1710 | |
| 1702 // TODO(ngeoffray): Warn if target is null and the send is | 1711 // TODO(ngeoffray): Warn if target is null and the send is |
| 1703 // unqualified. | 1712 // unqualified. |
| 1704 useElement(node, target); | 1713 useElement(node, target); |
| 1705 registerSend(selector, target); | 1714 registerSend(selector, target); |
| 1706 return node.isPropertyAccess ? target : null; | 1715 return node.isPropertyAccess ? target : null; |
| 1707 } | 1716 } |
| 1708 | 1717 |
| 1709 visitSendSet(SendSet node) { | 1718 visitSendSet(SendSet node) { |
| 1710 Element target = resolveSend(node); | 1719 Element target = resolveSend(node); |
| 1711 Element setter = target; | 1720 Element setter = target; |
| (...skipping 1252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2964 error(node, MessageKind.CANNOT_INSTANTIATE_TYPEDEF, [name]); | 2973 error(node, MessageKind.CANNOT_INSTANTIATE_TYPEDEF, [name]); |
| 2965 } else if (identical(e.kind, ElementKind.TYPE_VARIABLE)) { | 2974 } else if (identical(e.kind, ElementKind.TYPE_VARIABLE)) { |
| 2966 error(node, MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE, [name]); | 2975 error(node, MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE, [name]); |
| 2967 } else if (!identical(e.kind, ElementKind.CLASS) | 2976 } else if (!identical(e.kind, ElementKind.CLASS) |
| 2968 && !identical(e.kind, ElementKind.PREFIX)) { | 2977 && !identical(e.kind, ElementKind.PREFIX)) { |
| 2969 error(node, MessageKind.NOT_A_TYPE, [name]); | 2978 error(node, MessageKind.NOT_A_TYPE, [name]); |
| 2970 } | 2979 } |
| 2971 return e; | 2980 return e; |
| 2972 } | 2981 } |
| 2973 } | 2982 } |
| OLD | NEW |