Upvar, v0.1 (limited to looking up from eval in a function, to the function's args and vars).

This commit is contained in:
Brendan Eich
2008-08-21 03:47:33 -07:00
parent ee749b6a3b
commit 3601eb799d
17 changed files with 364 additions and 95 deletions

View File

@@ -1181,7 +1181,7 @@ GetArgOrVarAtom(JSPrinter *jp, uintN slot)
JSAtom *name;
LOCAL_ASSERT_RV(jp->fun, NULL);
LOCAL_ASSERT_RV(slot < JS_GET_LOCAL_NAME_COUNT(jp->fun), NULL);
LOCAL_ASSERT_RV(slot < (uintN) JS_GET_LOCAL_NAME_COUNT(jp->fun), NULL);
name = JS_LOCAL_NAME_TO_ATOM(jp->localNames[slot]);
#if !JS_HAS_DESTRUCTURING
LOCAL_ASSERT_RV(name, NULL);
@@ -2693,6 +2693,12 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb, JSOp nextop)
break;
}
case JSOP_CALLUPVAR:
case JSOP_GETUPVAR:
i = JS_UPVAR_LOCAL_NAME_START(jp->fun) + GET_UINT16(pc);
atom = GetArgOrVarAtom(jp, i);
goto do_name;
case JSOP_CALLLOCAL:
case JSOP_GETLOCAL:
if (IsVarSlot(jp, pc, &i)) {