diff --git a/jsdump.c b/jsdump.c index 747ff95..7027f9d 100644 --- a/jsdump.c +++ b/jsdump.c @@ -284,6 +284,7 @@ static void pexpi(int d, int p, js_Ast *exp) 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; diff --git a/jsrun.c b/jsrun.c index d55dc94..bcc788b 100644 --- a/jsrun.c +++ b/jsrun.c @@ -265,6 +265,11 @@ static js_Object *jsR_tofunction(js_State *J, int idx) /* 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_callscript(js_State *J, int n, js_Function *F) 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);