Bug 1558604 - Defer initializaton of JSFunction::nargs until after function parsing is done. r=jorendorff
The args count needs to be set before the LazyScript takes hold of the functionbox, or else some code that references lazy functions can get the wrong number of arguments (ie, CloneFunctionObjectIfNotSingleton on a lazy function) Differential Revision: https://phabricator.services.mozilla.com/D34586
This commit is contained in:
@@ -335,7 +335,7 @@ JS::Result<FunctionNode*> BinASTParserPerTokenizer<Tok>::buildFunction(
|
||||
// handled by setting the appropriate funbox field during argument parsing.
|
||||
if (!lazyScript_ ||
|
||||
lazyScript_->functionNonDelazifying() != funbox->function()) {
|
||||
funbox->function()->setArgCount(params ? uint16_t(params->count()) : 0);
|
||||
funbox->setArgCount(params ? uint16_t(params->count()) : 0);
|
||||
}
|
||||
|
||||
// ParseNode represents the body as concatenated after the params.
|
||||
|
||||
Reference in New Issue
Block a user