ref: f4bb8070715c0b847d9a69ab65c3c6b8abba8cf2
parent: be3ed5250c8505b8d544587e92b31924b134e678
author: Tor Andersson <tor@ccxvii.net>
date: Tue Feb 11 06:24:30 EST 2014
Fix eval() return value when no arguments are passed.
--- a/jsbuiltin.c
+++ b/jsbuiltin.c
@@ -29,10 +29,12 @@
static int jsB_eval(js_State *J, int argc)
{
- if (!js_isstring(J, -1))
+ if (!js_isstring(J, -1)) {
+ js_copy(J, 1);
return 1;
+ }
js_loadstring(J, "(eval)", js_tostring(J, -1));
- js_copy(J, 0);
+ js_pushglobal(J);
js_call(J, 0);
return 1;
}