8186646: Nashorn: "duplicate code" assertion when binding a vararg function that just passes arguments along

Reviewed-by: sundar, jlaskey
This commit is contained in:
Hannes Wallnöfer 2017-09-21 14:40:50 +02:00
parent 0f4c864067
commit 9ddbf8fde2
2 changed files with 42 additions and 0 deletions

View file

@ -537,6 +537,9 @@ final class CompiledFunction {
final int csParamCount = getParamCount(other);
final boolean csIsVarArg = csParamCount == Integer.MAX_VALUE;
if (csIsVarArg && isApplyToCall()) {
return false; // apply2call function must be called with exact number of parameters
}
final int thisThisIndex = needsCallee() ? 1 : 0; // Index of "this" parameter in this function's type
final int fnParamCountNoCallee = fnParamCount - thisThisIndex;