Index: pkg/compiler/lib/src/ssa/builder.dart |
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart |
index dea6da6f8cc2a35a6ed92750e30cb16b8b7fcd57..a853635da6671b0f4995458fbbcbc257becca448 100644 |
--- a/pkg/compiler/lib/src/ssa/builder.dart |
+++ b/pkg/compiler/lib/src/ssa/builder.dart |
@@ -4074,6 +4074,7 @@ class SsaBuilder extends ast.Visitor |
// Don't visit the first argument, which is the type, and the second |
// argument, which is the foreign code. |
if (link.isEmpty || link.tail.isEmpty) { |
+ // We should not get here because the call should be compiled to NSM. |
compiler.internalError(node.argumentsNode, |
'At least two arguments expected.'); |
} |
@@ -4083,6 +4084,16 @@ class SsaBuilder extends ast.Visitor |
List<HInstruction> inputs = <HInstruction>[]; |
addGenericSendArgumentsToList(link.tail.tail, inputs); |
+ if (nativeBehavior.codeTemplate.positionalArgumentCount != inputs.length) { |
+ compiler.reportError( |
+ node, MessageKind.GENERIC, |
+ {'text': |
+ 'Mismatch between number of placeholders' |
+ ' and number of arguments.'}); |
+ stack.add(graph.addConstantNull(compiler)); // Result expected on stack. |
+ return; |
+ } |
+ |
TypeMask ssaType = |
TypeMaskFactory.fromNativeBehavior(nativeBehavior, compiler); |