History

Fix error in Array.prototype.toString().

Tor Andersson committed 5 years ago

Commit c3715ce1 parent 6625d1e1 file · +4 −2Browse files

Showing the changes to jsarray.c (1 of 1 file). Show all

Unified · Split

jsarray.c+4−2
@@ -427,14 +427,16 @@ static void Ap_toString(js_State *J) · 426 unmodified lines
427427 js_typeerror(J, "'this' is not an object");
428428 js_getproperty(J, 0, "join");
429429 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
431432 js_getglobal(J, "Object");
433+ js_getproperty(J, -1, "prototype");
434+ js_rot2pop1(J);
432435 js_getproperty(J, -1, "toString");
433436 js_rot2pop1(J);
434437 }
435438 js_copy(J, 0);
436439 js_call(J, 0);
437− js_pop(J, 1);
438440 }
439441
440442 static void Ap_indexOf(js_State *J)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t