mirror of
https://github.com/ccxvii/mujs.git
synced 2026-09-23 00:38:31 +08:00
Use ECMA-262 r5 semantics for missing this argument to call/apply.
This commit is contained in:
+6
-12
@@ -52,13 +52,10 @@ static int Fp_apply(js_State *J, int n)
|
||||
char name[20];
|
||||
|
||||
if (!js_iscallable(J, 0))
|
||||
jsR_error(J, "TypeError");
|
||||
js_copy(J, 0);
|
||||
jsR_error(J, "TypeError: not a function");
|
||||
|
||||
if (js_isundefined(J, 1) || js_isnull(J, 1))
|
||||
js_pushglobal(J);
|
||||
else
|
||||
js_copy(J, 1);
|
||||
js_copy(J, 0);
|
||||
js_copy(J, 1);
|
||||
|
||||
js_getproperty(J, 2, "length");
|
||||
argc = js_tonumber(J, -1);
|
||||
@@ -78,13 +75,10 @@ static int Fp_call(js_State *J, int n)
|
||||
int i;
|
||||
|
||||
if (!js_iscallable(J, 0))
|
||||
jsR_error(J, "TypeError");
|
||||
js_copy(J, 0);
|
||||
jsR_error(J, "TypeError: not a function");
|
||||
|
||||
if (js_isundefined(J, 1) || js_isnull(J, 1))
|
||||
js_pushglobal(J);
|
||||
else
|
||||
js_copy(J, 1);
|
||||
js_copy(J, 0);
|
||||
js_copy(J, 1);
|
||||
|
||||
for (i = 1; i < n; ++i)
|
||||
js_copy(J, i + 1);
|
||||
|
||||
Reference in New Issue
Block a user