shithub: libmujs

Download patch

ref: 759d60958847720ee82f9db134f218d14be3f6b3
parent: 91c0e066a1ef458168babc5b2bbb509f69b7551a
author: Tor Andersson <[email protected]>
date: Wed Feb 12 11:26:47 EST 2014

Fixes.

--- a/jsdump.c
+++ b/jsdump.c
@@ -284,6 +284,7 @@
 	p = tp;
 
 	switch (exp->type) {
+	case AST_IDENTIFIER: ps(exp->string); break;
 	case EXP_IDENTIFIER: ps(exp->string); break;
 	case EXP_NUMBER: printf("%.9g", exp->number); break;
 	case EXP_STRING: pstr(exp->string); break;
--- a/jsrun.c
+++ b/jsrun.c
@@ -265,6 +265,11 @@
 
 /* Stack manipulation */
 
+int js_gettop(js_State *J)
+{
+	return TOP - BOT;
+}
+
 void js_pop(js_State *J, int n)
 {
 	TOP -= n;
@@ -838,9 +843,9 @@
 
 static void jsR_callcfunction(js_State *J, int n, int min, js_CFunction F)
 {
-	int rv;
+	int rv, i;
 
-	while (min++ < n)
+	for (i = n; i < min; ++i)
 		js_pushundefined(J);
 
 	rv = F(J, n);