Bug 1602878 - Don't call FunctionBox::initWithEnclosingScope with nullptr. r=mgaudet

When creating a FunctionBox for a skipped-over-lazy function we do not yet
know it's enclosing scope. Remove calls to initWithEnclosingScope for this
case. This avoids asking for the enclosingScope() of a function that doesn't
have one yet.

Also remove an assert from the BytecodeEmitter that was using partially
initialized flags. The condition was previously checked when the
LazyScript::NeedsHomeObject flag was initialized.

Differential Revision: https://phabricator.services.mozilla.com/D56723
This commit is contained in:
Ted Campbell
2019-12-11 20:12:35 +00:00
parent 195b6e4ed1
commit 568523a18a
5 changed files with 12 additions and 12 deletions

View File

@@ -290,6 +290,7 @@ JS::Result<FunctionBox*> BinASTParserPerTokenizer<Tok>::buildFunctionBox(
funbox->initWithEnclosingParseContext(pc_, fun, syntax);
} else {
funbox->initFromLazyFunction(fun);
funbox->initWithEnclosingScope(fun);
}
return funbox;
}