mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Bug 1497792 - Make arguments objects for more functions in BinAST. (r=arai)
--HG-- extra : rebase_source : 774ac7ef9c638786baa62364bdbeb86504158b35
This commit is contained in:
parent
6f88a7757b
commit
ae0de9dc24
@ -340,16 +340,27 @@ BinASTParser<Tok>::buildFunction(const size_t start, const BinKind kind, ParseNo
|
||||
// as they don't yet apply to us.
|
||||
HandlePropertyName arguments = cx_->names().arguments;
|
||||
if (hasUsedName(arguments) || parseContext_->functionBox()->bindingsAccessedDynamically()) {
|
||||
funbox->usesArguments = true;
|
||||
|
||||
ParseContext::Scope& funScope = parseContext_->functionScope();
|
||||
ParseContext::Scope::AddDeclaredNamePtr p = funScope.lookupDeclaredNameForAdd(arguments);
|
||||
if (!p) {
|
||||
BINJS_TRY(funScope.addDeclaredName(parseContext_, p, arguments, DeclarationKind::Var,
|
||||
DeclaredNameInfo::npos));
|
||||
funbox->declaredArguments = true;
|
||||
funbox->usesArguments = true;
|
||||
} else if (p->value()->kind() != DeclarationKind::Var) {
|
||||
// Lexicals, formal parameters, and body level functions shadow.
|
||||
funbox->usesArguments = false;
|
||||
}
|
||||
|
||||
if (funbox->usesArguments) {
|
||||
funbox->setArgumentsHasLocalBinding();
|
||||
funbox->setDefinitelyNeedsArgsObj();
|
||||
|
||||
if (parseContext_->sc()->bindingsAccessedDynamically() ||
|
||||
parseContext_->sc()->hasDebuggerStatement())
|
||||
{
|
||||
funbox->setDefinitelyNeedsArgsObj();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user