* If a retval is in a callee arguments scope it
* must be in the previous callee arguments scope.
*/
- vm->scopes[NJS_SCOPE_CALLEE_ARGUMENTS] =
- vm->top_frame->arguments + function->args_offset;
+ args = vm->top_frame->arguments;
+ function = vm->top_frame->function;
+
+ if (function != NULL) {
+ args += function->args_offset;
+ }
+
+ vm->scopes[NJS_SCOPE_CALLEE_ARGUMENTS] = args;
retval = njs_vmcode_operand(vm, retval);
/*
{ nxt_string("var f = ''.concat.bind(0, 1, 2, 3, 4); f(5, 6, 7, 8, 9)"),
nxt_string("0123456789") },
+ { nxt_string("var f = ''.concat.bind(0, 1, 2, 3, 4); f(Math.sqrt(25))"),
+ nxt_string("012345") },
+
{ nxt_string("var f = String.prototype.concat.bind(0, 1); f(2)"),
nxt_string("012") },