Don't optimize variable names in with statements. bug 448595, r=brendan

This commit is contained in:
Blake Kaplan 2008-08-04 10:07:06 -07:00
Родитель 9a06360391
Коммит 66418514ea
1 изменённых файлов: 1 добавлений и 9 удалений

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

@ -1843,8 +1843,7 @@ BindNameToSlot(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn,
*/
tc = &cg->treeContext;
atom = pn->pn_atom;
if (declType != VAR_DECL &&
(stmt = js_LexicalLookup(tc, atom, &slot, declType))) {
if ((stmt = js_LexicalLookup(tc, atom, &slot, declType))) {
if (stmt->type == STMT_WITH)
return JS_TRUE;
@ -1885,14 +1884,7 @@ BindNameToSlot(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn,
/*
* We are compiling a script or eval, and eval is not inside a function
* activation.
*
* We can't optimize if this name use is within a with statement in
* the same compilation unit, or if the compiler was invoked by eval
* called inside a with statement in its caller.
*/
if (js_InWithStatement(tc))
return JS_TRUE;
fp = cx->fp;
if (fp->scopeChain != fp->varobj)
return JS_TRUE;