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

Unified 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: Remove isValid. Created 8 years, 2 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/compiler/implementation/lib/js_helper.dart ('k') | lib/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/resolution/members.dart
diff --git a/lib/compiler/implementation/resolution/members.dart b/lib/compiler/implementation/resolution/members.dart
index 3338049359c14c67d7b12a3d9dff106b97e3e6e4..07d034c5ab57babf2da11cefd9714e71ce4c4f40 100644
--- a/lib/compiler/implementation/resolution/members.dart
+++ b/lib/compiler/implementation/resolution/members.dart
@@ -1698,15 +1698,18 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
Selector selector = mapping.getSelector(node);
if (selector == null) return;
- // If we don't know what we're calling or if we are calling a getter,
- // we need to register that fact that we may be calling a closure
- // with the same arguments.
- if (node.isCall &&
- (Elements.isUnresolved(target) ||
- target.isGetter() ||
- Elements.isClosureSend(node, target))) {
- Selector call = new Selector.callClosureFrom(selector);
- world.registerDynamicInvocation(call.name, call);
+ if (node.isCall) {
+ if (Elements.isUnresolved(target) ||
+ target.isGetter() ||
+ Elements.isClosureSend(node, target)) {
+ // If we don't know what we're calling or if we are calling a getter,
+ // we need to register that fact that we may be calling a closure
+ // with the same arguments.
+ Selector call = new Selector.callClosureFrom(selector);
+ world.registerDynamicInvocation(call.name, call);
+ } else if (!selector.applies(target, compiler)) {
+ warnArgumentMismatch(node, target);
+ }
}
// TODO(ngeoffray): Warn if target is null and the send is
@@ -1716,6 +1719,13 @@ class ResolverVisitor extends CommonResolverVisitor<Element> {
return node.isPropertyAccess ? target : null;
}
+ void warnArgumentMismatch(Send node, Element target) {
+ // TODO(karlklose): we can be more precise about the reason of the
+ // mismatch.
+ warning(node.argumentsNode, MessageKind.INVALID_ARGUMENTS,
+ [target.name]);
+ }
+
visitSendSet(SendSet node) {
Element target = resolveSend(node);
Element setter = target;
« no previous file with comments | « lib/compiler/implementation/lib/js_helper.dart ('k') | lib/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698