Unified · Split
| @@ -427,14 +427,16 @@ static void Ap_toString(js_State *J) · 426 unmodified lines | |||
| 427 | js_typeerror(J, "'this' is not an object"); | 427 | js_typeerror(J, "'this' is not an object"); |
| 428 | js_getproperty(J, 0, "join"); | 428 | js_getproperty(J, 0, "join"); |
| 429 | if (!js_iscallable(J, -1)) { | 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 | js_getglobal(J, "Object"); | 432 | js_getglobal(J, "Object"); |
| 433 | js_getproperty(J, -1, "prototype"); | ||
| 434 | js_rot2pop1(J); | ||
| 432 | js_getproperty(J, -1, "toString"); | 435 | js_getproperty(J, -1, "toString"); |
| 433 | js_rot2pop1(J); | 436 | js_rot2pop1(J); |
| 434 | } | 437 | } |
| 435 | js_copy(J, 0); | 438 | js_copy(J, 0); |
| 436 | js_call(J, 0); | 439 | js_call(J, 0); |
| 437 | js_pop(J, 1); | ||
| 438 | } | 440 | } |
| 439 | 441 | ||
| 440 | static void Ap_indexOf(js_State *J) | 442 | static void Ap_indexOf(js_State *J) |