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:
@@ -290,6 +290,7 @@ JS::Result<FunctionBox*> BinASTParserPerTokenizer<Tok>::buildFunctionBox(
|
||||
funbox->initWithEnclosingParseContext(pc_, fun, syntax);
|
||||
} else {
|
||||
funbox->initFromLazyFunction(fun);
|
||||
funbox->initWithEnclosingScope(fun);
|
||||
}
|
||||
return funbox;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user