Index: compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java |
diff --git a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java |
index c7815476b0e5446c4e45510b222881d4cb364309..c2bc54e3c06498d0b4ba9016568e5d42da211af1 100644 |
--- a/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java |
+++ b/compiler/java/com/google/dart/compiler/type/TypeAnalyzer.java |
@@ -849,19 +849,27 @@ public class TypeAnalyzer implements DartCompilationPhase { |
Iterator<Type> argumentTypes, FunctionType ftype) { |
int argumentIndex = 0; |
// Check positional parameters. |
- List<Type> parameterTypes = ftype.getParameterTypes(); |
- for (Type parameterType : parameterTypes) { |
- parameterType.getClass(); // quick null check |
- if (argumentTypes.hasNext()) { |
- Type argumentType = argumentTypes.next(); |
- argumentType.getClass(); // quick null check |
- checkAssignable(argumentNodes.get(argumentIndex), parameterType, argumentType); |
- argumentIndex++; |
- } else { |
- onError(diagnosticNode, TypeErrorCode.MISSING_ARGUMENT, parameterType); |
- return ftype.getReturnType(); |
+ { |
+ List<Type> parameterTypes = ftype.getParameterTypes(); |
+ for (Type parameterType : parameterTypes) { |
+ parameterType.getClass(); // quick null check |
+ if (argumentTypes.hasNext()) { |
+ Type argumentType = argumentTypes.next(); |
+ argumentType.getClass(); // quick null check |
+ DartExpression argumentNode = argumentNodes.get(argumentIndex); |
+ if (argumentNode instanceof DartNamedExpression) { |
+ onError(argumentNode, TypeErrorCode.EXPECTED_POSITIONAL_ARGUMENT, parameterType); |
+ return ftype.getReturnType(); |
+ } |
+ checkAssignable(argumentNodes.get(argumentIndex), parameterType, argumentType); |
+ argumentIndex++; |
+ } else { |
+ onError(diagnosticNode, TypeErrorCode.MISSING_ARGUMENT, parameterType); |
+ return ftype.getReturnType(); |
+ } |
} |
} |
+ |
// Check named parameters. |
{ |
Set<String> usedNamedParametersPositional = Sets.newHashSet(); |