From c32f0be846a259f250fc56930f1ab6ee259c1dc8 Mon Sep 17 00:00:00 2001 From: Matthew Olsson Date: Sun, 7 Jan 2024 09:19:40 -0700 Subject: [PATCH] NativeCall: Fix not binding rest arg identifiers --- src/main/java/org/mozilla/javascript/NativeCall.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/mozilla/javascript/NativeCall.java b/src/main/java/org/mozilla/javascript/NativeCall.java index 03773a59a..8cfdce72b 100644 --- a/src/main/java/org/mozilla/javascript/NativeCall.java +++ b/src/main/java/org/mozilla/javascript/NativeCall.java @@ -43,7 +43,7 @@ static void init(Scriptable scope, boolean sealed) { int paramAndVarCount = function.getParamAndVarCount(); int paramCount = function.getParamCount(); if (paramAndVarCount != 0) { - for (int i = 0; i < paramCount; ++i) { + for (int i = 0; i < paramCount + (function.hasRest() ? 1 : 0); ++i) { String name = function.getParamOrVarName(i); Object val = i < this.effectiveArgs.length ? this.effectiveArgs[i] : Undefined.instance; defineProperty(name, val, NOT_CONFIGURABLE);