Bug 883439 - Lazily parse scripts defined within catch blocks, r=luke.

This commit is contained in:
Brian Hackett
2013-06-15 07:54:22 -06:00
parent 369dce9cd2
commit c3affa9724
6 changed files with 40 additions and 29 deletions

View File

@@ -340,20 +340,21 @@ frontend::CompileLazyFunction(JSContext *cx, HandleFunction fun, LazyScript *laz
Parser<FullParseHandler> parser(cx, options, chars, length,
/* foldConstants = */ true, NULL, lazy);
RootedObject enclosingScope(cx, lazy->parentFunction());
uint32_t staticLevel = lazy->staticLevel(cx);
ParseNode *pn = parser.standaloneLazyFunction(fun, lazy->staticLevel(), lazy->strict());
ParseNode *pn = parser.standaloneLazyFunction(fun, staticLevel, lazy->strict());
if (!pn)
return false;
if (!NameFunctions(cx, pn))
return false;
RootedObject enclosingScope(cx, lazy->enclosingScope());
JS::RootedScriptSource sourceObject(cx, lazy->sourceObject());
JS_ASSERT(sourceObject);
Rooted<JSScript*> script(cx, JSScript::Create(cx, enclosingScope, false,
options, lazy->staticLevel(),
options, staticLevel,
sourceObject, lazy->begin(), lazy->end()));
if (!script)
return false;