ref: 84858c335ed5fe584c7c731f5090f8175f66a675
parent: a2b62c028e3af0508485dde2cd849cba21c1b691
author: Tor Andersson <tor.andersson@artifex.com>
date: Mon Sep 3 15:37:55 EDT 2018
mujs shell: Make the load function behave like in the SpiderMonkey shell.
--- a/main.c
+++ b/main.c
@@ -93,9 +93,14 @@
static void jsB_load(js_State *J)
{
- const char *filename = js_tostring(J, 1);
- int rv = js_dofile(J, filename);
- js_pushboolean(J, !rv);
+ int i, n = js_gettop(J);
+ for (i = 1; i < n; ++i) {
+ js_loadfile(J, js_tostring(J, i));
+ js_pushundefined(J);
+ js_call(J, 0);
+ js_pop(J, 1);
+ }
+ js_pushundefined(J);
}
static void jsB_print(js_State *J)