mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-24 16:17:29 +09:00
Issue #2173 - Add accessors to LexicalScopeNode
Based-on: m-c 1479659/7
This commit is contained in:
parent
a49f4d0483
commit
3bd300e263
12 changed files with 180 additions and 171 deletions
|
|
@ -668,8 +668,7 @@ static inline ParseNode*
|
|||
FunctionStatementList(CodeNode* funNode)
|
||||
{
|
||||
MOZ_ASSERT(funNode->body()->isKind(PNK_PARAMSBODY));
|
||||
ParseNode* last = funNode->body()->as<ListNode>().last();
|
||||
MOZ_ASSERT(last->isKind(PNK_LEXICALSCOPE));
|
||||
LexicalScopeNode* last = &funNode->body()->as<ListNode>().last()->as<LexicalScopeNode>();
|
||||
MOZ_ASSERT(last->isEmptyScope());
|
||||
ParseNode* body = last->scopeBody();
|
||||
MOZ_ASSERT(body->isKind(PNK_STATEMENTLIST));
|
||||
|
|
@ -6807,10 +6806,11 @@ CheckSwitch(FunctionValidator& f, ParseNode* switchStmt)
|
|||
ParseNode* switchExpr = BinaryLeft(switchStmt);
|
||||
ParseNode* switchBody = BinaryRight(switchStmt);
|
||||
|
||||
if (switchBody->isKind(PNK_LEXICALSCOPE)) {
|
||||
if (!switchBody->isEmptyScope())
|
||||
return f.fail(switchBody, "switch body may not contain lexical declarations");
|
||||
switchBody = switchBody->scopeBody();
|
||||
if (switchBody->is<LexicalScopeNode>()) {
|
||||
LexicalScopeNode* scope = &switchBody->as<LexicalScopeNode>();
|
||||
if (!scope->isEmptyScope())
|
||||
return f.fail(scope, "switch body may not contain lexical declarations");
|
||||
switchBody = scope->scopeBody();
|
||||
}
|
||||
|
||||
ParseNode* stmt = ListHead(switchBody);
|
||||
|
|
@ -6984,10 +6984,9 @@ CheckStatementList(FunctionValidator& f, ParseNode* stmtList, const NameVector*
|
|||
}
|
||||
|
||||
static bool
|
||||
CheckLexicalScope(FunctionValidator& f, ParseNode* lexicalScope)
|
||||
CheckLexicalScope(FunctionValidator& f, ParseNode* node)
|
||||
{
|
||||
MOZ_ASSERT(lexicalScope->isKind(PNK_LEXICALSCOPE));
|
||||
|
||||
LexicalScopeNode* lexicalScope = &node->as<LexicalScopeNode>();
|
||||
if (!lexicalScope->isEmptyScope())
|
||||
return f.fail(lexicalScope, "cannot have 'let' or 'const' declarations");
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue