Showing the changes to jsarray.c (1 of 1 file). Show all
Unified · Split
| @@ -427,14 +427,16 @@ static void Ap_toString(js_State *J) · 426 unmodified lines | ||
| 427 | 427 | js_typeerror(J, "'this' is not an object"); |
| 428 | 428 | js_getproperty(J, 0, "join"); |
| 429 | 429 | if (!js_iscallable(J, -1)) { |
| 430 | − // TODO: call Object.prototype.toString implementation; not via Object.toString JS objects | |
| 430 | + js_pop(J, 1); | |
| 431 | + // TODO: call Object.prototype.toString implementation directly | |
| 431 | 432 | js_getglobal(J, "Object"); |
| 433 | + js_getproperty(J, -1, "prototype"); | |
| 434 | + js_rot2pop1(J); | |
| 432 | 435 | js_getproperty(J, -1, "toString"); |
| 433 | 436 | js_rot2pop1(J); |
| 434 | 437 | } |
| 435 | 438 | js_copy(J, 0); |
| 436 | 439 | js_call(J, 0); |
| 437 | − js_pop(J, 1); | |
| 438 | 440 | } |
| 439 | 441 | |
| 440 | 442 | static void Ap_indexOf(js_State *J) |