Fix hard case of empty group assignment in let block head (355635, r=mrbkap).

git-svn-id: svn://10.0.0.236/trunk@213220 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
brendan%mozilla.org 2006-10-06 07:50:47 +00:00
parent fbbeb475be
commit 416dd83125

View File

@ -2065,11 +2065,22 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
goto do_forloop;
}
if (SN_TYPE(sn) == SRC_DECL) {
todo = SprintCString(&ss->sprinter, rval);
if (todo < 0 ||
!PushOff(ss, todo, JSOP_NOP)) {
return NULL;
if (ss->top == jp->script->depth) {
/*
* This must be an empty destructuring
* in the head of a let whose body block
* is also empty.
*/
pc = pc2 + 1;
len = js_GetSrcNoteOffset(sn, 0);
LOCAL_ASSERT(pc[len] == JSOP_LEAVEBLOCK);
js_printf(jp, "\tlet (%s) {\n", rval);
js_printf(jp, "\t}\n");
goto end_setsp;
}
todo = SprintCString(&ss->sprinter, rval);
if (todo < 0 || !PushOff(ss, todo, JSOP_NOP))
return NULL;
op = JSOP_POP;
pc = pc2 + 1;
goto do_letheadbody;
@ -2091,9 +2102,11 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
/*
* If control flow reaches this point with todo still -2,
* just print rval as an expression statement.
*/
if (todo == -2)
js_printf(jp, "\t%s;\n", rval);
end_setsp:
break;
}
#endif