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

Unified Diff: compiler/java/com/google/dart/compiler/resolver/Resolver.java

Issue 10668045: An implicit super() invocation wasn't being checked for the wrong # of args (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 | « no previous file | compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: compiler/java/com/google/dart/compiler/resolver/Resolver.java
diff --git a/compiler/java/com/google/dart/compiler/resolver/Resolver.java b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
index 85c25767169626ae362b88485f028352c4455342..503a7acdee1e583cb26313227cacffd2956471db 100644
--- a/compiler/java/com/google/dart/compiler/resolver/Resolver.java
+++ b/compiler/java/com/google/dart/compiler/resolver/Resolver.java
@@ -1895,9 +1895,25 @@ public class Resolver {
if (supertype != null) {
superCall = Elements.lookupConstructor(supertype.getElement(), "");
}
+ if (superCall != null) {
+
+ // Do positional parameters match?
+ List<VariableElement> superParameters = superCall.getParameters();
+ // Count the number of positional parameters required by super call
+ int superPositionalCount = 0;
+ for (; superPositionalCount < superParameters.size(); superPositionalCount++) {
+ if (superParameters.get(superPositionalCount).isNamed()) {
+ break;
+ }
+ }
+ if (superPositionalCount > 0) {
+ onError(node, ResolverErrorCode.TOO_FEW_ARGUMENTS_IN_IMPLICIT_SUPER,
+ superCall.getType().toString());
+ }
+ }
}
- if ((superCall == null)
+ if (superCall == null
&& !currentClass.isObject()
&& !currentClass.isObjectChild()) {
InterfaceType supertype = currentClass.getSupertype();
@@ -1911,7 +1927,7 @@ public class Resolver {
}
}
}
- } else if ((superCall != null)
+ } else if (superCall != null
&& node.getModifiers().isConstant()
&& !superCall.getModifiers().isConstant()) {
onError(node.getName(),
« no previous file with comments | « no previous file | compiler/java/com/google/dart/compiler/resolver/ResolverErrorCode.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698