Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(715)

Side by Side Diff: lib/compiler/implementation/resolution/members.dart

Issue 11273034: Make unmatched static call a runtime error. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix a bug. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1702 // we need to register that fact that we may be calling a closure 1702 // we need to register that fact that we may be calling a closure
1703 // with the same arguments. 1703 // with the same arguments.
1704 if (node.isCall && 1704 if (node.isCall &&
1705 (Elements.isUnresolved(target) || 1705 (Elements.isUnresolved(target) ||
1706 target.isGetter() || 1706 target.isGetter() ||
1707 Elements.isClosureSend(node, target))) { 1707 Elements.isClosureSend(node, target))) {
1708 Selector call = new Selector.callClosureFrom(selector); 1708 Selector call = new Selector.callClosureFrom(selector);
1709 world.registerDynamicInvocation(call.name, call); 1709 world.registerDynamicInvocation(call.name, call);
1710 } 1710 }
1711 1711
1712 if (Elements.isValid(target) && target.hasSignature()
ngeoffray 2012/10/25 14:21:58 Actually, I'd prefer having the applies method tak
ahe 2012/10/25 15:37:36 I agree.
karlklose 2012/10/26 11:08:48 We only want to warn if the element is known and h
1713 && !selector.applies(target, compiler)) {
1714 // TODO(karlklose): we can be more precise about the reason of the
1715 // mismatch.
1716 warning(node, MessageKind.INVALID_ARGUMENTS, [target.name]);
1717 }
1718
1712 // TODO(ngeoffray): Warn if target is null and the send is 1719 // TODO(ngeoffray): Warn if target is null and the send is
1713 // unqualified. 1720 // unqualified.
1714 useElement(node, target); 1721 useElement(node, target);
1715 registerSend(selector, target); 1722 registerSend(selector, target);
1716 return node.isPropertyAccess ? target : null; 1723 return node.isPropertyAccess ? target : null;
1717 } 1724 }
1718 1725
1719 visitSendSet(SendSet node) { 1726 visitSendSet(SendSet node) {
1720 Element target = resolveSend(node); 1727 Element target = resolveSend(node);
1721 Element setter = target; 1728 Element setter = target;
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
2975 error(node, MessageKind.CANNOT_INSTANTIATE_TYPEDEF, [name]); 2982 error(node, MessageKind.CANNOT_INSTANTIATE_TYPEDEF, [name]);
2976 } else if (identical(e.kind, ElementKind.TYPE_VARIABLE)) { 2983 } else if (identical(e.kind, ElementKind.TYPE_VARIABLE)) {
2977 error(node, MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE, [name]); 2984 error(node, MessageKind.CANNOT_INSTANTIATE_TYPE_VARIABLE, [name]);
2978 } else if (!identical(e.kind, ElementKind.CLASS) 2985 } else if (!identical(e.kind, ElementKind.CLASS)
2979 && !identical(e.kind, ElementKind.PREFIX)) { 2986 && !identical(e.kind, ElementKind.PREFIX)) {
2980 error(node, MessageKind.NOT_A_TYPE, [name]); 2987 error(node, MessageKind.NOT_A_TYPE, [name]);
2981 } 2988 }
2982 return e; 2989 return e;
2983 } 2990 }
2984 } 2991 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698