Bug 490339 - Unexpected ReferenceError when using "new Function()" (r=mrbkap).

This commit is contained in:
Brendan Eich 2009-04-27 14:47:17 -07:00
parent 215627f0fb
commit d07019814f

View File

@ -2089,25 +2089,23 @@ JSCompiler::setFunctionKinds(JSFunctionBox *funbox, uint16& tcflags)
JSFunctionBox *afunbox = funbox->parent; JSFunctionBox *afunbox = funbox->parent;
uintN lexdepLevel = lexdep->frameLevel(); uintN lexdepLevel = lexdep->frameLevel();
if (!afunbox) { while (afunbox) {
if (tcflags & TCF_IN_FUNCTION) /*
tcflags |= TCF_FUN_HEAVYWEIGHT; * NB: afunbox->level is the static level of
} else { * the definition or expression of the function
do { * parsed into afunbox, not the static level of
/* * its body. Therefore we must add 1 to match
* NB: afunbox->level is the static level of * lexdep's level to find the afunbox whose
* the definition or expression of the function * body contains the lexdep definition.
* parsed into afunbox, not the static level of */
* its body. Therefore we must add 1 to match if (afunbox->level + 1U == lexdepLevel) {
* lexdep's level to find the afunbox whose afunbox->tcflags |= TCF_FUN_HEAVYWEIGHT;
* body contains the lexdep definition. break;
*/ }
if (afunbox->level + 1U == lexdepLevel) { afunbox = afunbox->parent;
afunbox->tcflags |= TCF_FUN_HEAVYWEIGHT;
break;
}
} while ((afunbox = afunbox->parent) != NULL);
} }
if (!afunbox && (tcflags & TCF_IN_FUNCTION))
tcflags |= TCF_FUN_HEAVYWEIGHT;
} }
} }
} }