mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 880538 - move 'hasDestructuringArgs' flag into the FunctionBox (r=bhackett)
--HG-- extra : rebase_source : d65025cd591c7faf9e64f4768da0b2b8352ee393
This commit is contained in:
parent
be562454f2
commit
de23e334eb
@ -464,6 +464,7 @@ FunctionBox::FunctionBox(ExclusiveContext *cx, ObjectBox* traceListHead, JSFunct
|
||||
ndefaults(0),
|
||||
inWith(false), // initialized below
|
||||
inGenexpLambda(false),
|
||||
hasDestructuringArgs(false),
|
||||
useAsm(false),
|
||||
insideUseAsm(outerpc && outerpc->useAsmOrInsideUseAsm()),
|
||||
usesArguments(false),
|
||||
@ -1533,7 +1534,6 @@ Parser<ParseHandler>::functionArguments(FunctionSyntaxKind kind, Node *listp, No
|
||||
if (parenFreeArrow || !tokenStream.matchToken(TOK_RP)) {
|
||||
bool hasDefaults = false;
|
||||
Node duplicatedArg = null();
|
||||
bool destructuringArg = false;
|
||||
#if JS_HAS_DESTRUCTURING
|
||||
Node list = null();
|
||||
#endif
|
||||
@ -1562,7 +1562,7 @@ Parser<ParseHandler>::functionArguments(FunctionSyntaxKind kind, Node *listp, No
|
||||
return false;
|
||||
}
|
||||
|
||||
destructuringArg = true;
|
||||
funbox->hasDestructuringArgs = true;
|
||||
|
||||
/*
|
||||
* A destructuring formal parameter turns into one or more
|
||||
@ -1624,7 +1624,7 @@ Parser<ParseHandler>::functionArguments(FunctionSyntaxKind kind, Node *listp, No
|
||||
funbox->setStart(tokenStream);
|
||||
|
||||
RootedPropertyName name(context, tokenStream.currentToken().name());
|
||||
bool disallowDuplicateArgs = destructuringArg || hasDefaults;
|
||||
bool disallowDuplicateArgs = funbox->hasDestructuringArgs || hasDefaults;
|
||||
if (!defineArg(funcpn, name, disallowDuplicateArgs, &duplicatedArg))
|
||||
return false;
|
||||
|
||||
|
@ -262,6 +262,7 @@ class FunctionBox : public ObjectBox, public SharedContext
|
||||
uint16_t ndefaults;
|
||||
bool inWith:1; /* some enclosing scope is a with-statement */
|
||||
bool inGenexpLambda:1; /* lambda from generator expression */
|
||||
bool hasDestructuringArgs:1; /* arguments list contains destructuring expression */
|
||||
bool useAsm:1; /* function contains "use asm" directive */
|
||||
bool insideUseAsm:1; /* nested function of function of "use asm" directive */
|
||||
|
||||
|
@ -2643,6 +2643,8 @@ CheckFunctionHead(ModuleCompiler &m, ParseNode *fn, ParseNode **stmtIter)
|
||||
return m.fail(fn, "rest args not allowed");
|
||||
if (!FunctionHasStatementList(fn))
|
||||
return m.fail(fn, "expression closures not allowed");
|
||||
if (fn->pn_funbox->hasDestructuringArgs)
|
||||
return m.fail(fn, "destructuring args not allowed");
|
||||
|
||||
*stmtIter = ListHead(FunctionStatementList(fn));
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user