Skip to content

Commit f47ec32

Browse files
committed
Do binding for special symbols even in defer parse
1 parent bcbe109 commit f47ec32

3 files changed

Lines changed: 8 additions & 8 deletions

File tree

lib/Parser/Parse.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1693,11 +1693,10 @@ ParseNodePtr Parser::CreateSpecialVarDeclIfNeeded(ParseNodePtr pnodeFnc, IdentPt
16931693
return nullptr;
16941694
}
16951695

1696-
template<bool buildAST>
16971696
void Parser::CreateSpecialSymbolDeclarations(ParseNodePtr pnodeFnc, bool isGlobal)
16981697
{
16991698
// Lambda function cannot have any special bindings.
1700-
if (!buildAST || pnodeFnc->sxFnc.IsLambda())
1699+
if (pnodeFnc->sxFnc.IsLambda())
17011700
{
17021701
return;
17031702
}
@@ -5689,7 +5688,7 @@ bool Parser::ParseFncDeclHelper(ParseNodePtr pnodeFnc, LPCOLESTR pNameHint, usho
56895688
UpdateArgumentsNode(pnodeFnc, argNode);
56905689
}
56915690

5692-
CreateSpecialSymbolDeclarations<buildAST>(pnodeFnc, false);
5691+
CreateSpecialSymbolDeclarations(pnodeFnc, false);
56935692

56945693
// Restore the lists of scopes that contain function expressions.
56955694

@@ -6981,7 +6980,7 @@ ParseNodePtr Parser::GenerateEmptyConstructor(bool extends)
69816980

69826981
FinishParseBlock(pnodeInnerBlock);
69836982

6984-
CreateSpecialSymbolDeclarations<buildAST>(pnodeFnc, false);
6983+
CreateSpecialSymbolDeclarations(pnodeFnc, false);
69856984

69866985
FinishParseBlock(pnodeBlock);
69876986

@@ -11241,7 +11240,7 @@ void Parser::FinishDeferredFunction(ParseNodePtr pnodeScopeList)
1124111240
UpdateArgumentsNode(pnodeFnc, argNode);
1124211241
}
1124311242

11244-
CreateSpecialSymbolDeclarations<true>(pnodeFnc, false);
11243+
CreateSpecialSymbolDeclarations(pnodeFnc, false);
1124511244

1124611245
this->FinishParseBlock(pnodeBlock);
1124711246
if (pnodeFncExprBlock)
@@ -11624,7 +11623,7 @@ ParseNodePtr Parser::Parse(LPCUTF8 pszSrc, size_t offset, size_t length, charcou
1162411623
// We only need to create special symbol bindings for 'this' for indirect eval
1162511624
if ((this->m_grfscr & fscrEvalCode) && !(this->m_grfscr & fscrEval))
1162611625
{
11627-
CreateSpecialSymbolDeclarations<true>(pnodeProg, true);
11626+
CreateSpecialSymbolDeclarations(pnodeProg, true);
1162811627
}
1162911628

1163011629
// Append an EndCode node.

lib/Parser/Parse.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -765,7 +765,7 @@ class Parser
765765
void FinishParseBlock(ParseNode *pnodeBlock, bool needScanRCurly = true);
766766
void FinishParseFncExprScope(ParseNodePtr pnodeFnc, ParseNodePtr pnodeFncExprScope);
767767

768-
template<bool buildAST> void CreateSpecialSymbolDeclarations(ParseNodePtr pnodeFnc, bool isGlobal);
768+
void CreateSpecialSymbolDeclarations(ParseNodePtr pnodeFnc, bool isGlobal);
769769
ParseNodePtr ReferenceSpecialName(IdentPtr pid, charcount_t ichMin = 0, charcount_t ichLim = 0, bool createNode = false);
770770
ParseNodePtr CreateSpecialVarDeclIfNeeded(ParseNodePtr pnodeFnc, IdentPtr pid, bool forceCreate = false);
771771

lib/Runtime/ByteCode/FuncInfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ BOOL FuncInfo::IsClassMember() const
139139
return this->byteCodeFunction->IsClassMethod();
140140
}
141141

142-
BOOL FuncInfo::IsLambda() const {
142+
BOOL FuncInfo::IsLambda() const
143+
{
143144
return this->byteCodeFunction->IsLambda();
144145
}
145146

0 commit comments

Comments
 (0)