Fix special case of new (f()()) and the like (352013 part deux, r=mrbkap).

This commit is contained in:
brendan@mozilla.org 2007-04-04 16:32:33 -07:00
Родитель 56b7d64bf8
Коммит 542c68db4a
1 изменённых файлов: 13 добавлений и 1 удалений

Просмотреть файл

@ -3141,8 +3141,20 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb)
LOCAL_ASSERT(ss->top >= 2);
(void) PopOff(ss, op);
/*
* Special case: new (x(y)(z)) must be parenthesized like so.
* Same for new (x(y).z) -- contrast with new x(y).z.
*/
op = ss->opcodes[ss->top-1];
lval = PopStr(ss,
(saveop == JSOP_NEW &&
(op == JSOP_CALL ||
(js_CodeSpec[op].format & JOF_CALLOP)))
? JSOP_NAME
: saveop);
op = saveop;
argv[0] = JS_strdup(cx, POP_STR());
argv[0] = JS_strdup(cx, lval);
if (!argv[i])
ok = JS_FALSE;