|
|
@@ -331,7 +331,7 @@ HRESULT Parser::ValidateSyntax(LPCUTF8 pszSrc, size_t encodedCharCount, bool isG
|
|
|
}
|
|
|
|
|
|
HRESULT Parser::ParseSourceInternal(
|
|
|
- __out ParseNodePtr* parseTree, LPCUTF8 pszSrc, size_t offsetInBytes, size_t encodedCharCount, charcount_t offsetInChars,
|
|
|
+ __out ParseNodeProg ** parseTree, LPCUTF8 pszSrc, size_t offsetInBytes, size_t encodedCharCount, charcount_t offsetInChars,
|
|
|
bool isUtf8, ULONG grfscr, CompileScriptException *pse, Js::LocalFunctionId * nextFunctionId, ULONG lineNumber, SourceContextInfo * sourceContextInfo)
|
|
|
{
|
|
|
Assert(parseTree);
|
|
|
@@ -357,7 +357,7 @@ HRESULT Parser::ParseSourceInternal(
|
|
|
m_grfscr = grfscr;
|
|
|
m_sourceContextInfo = sourceContextInfo;
|
|
|
|
|
|
- ParseNodePtr pnodeBase = NULL;
|
|
|
+ ParseNodeProg * pnodeBase = NULL;
|
|
|
HRESULT hr;
|
|
|
SmartFPUControl smartFpuControl;
|
|
|
|
|
|
@@ -917,27 +917,27 @@ ParseNodeInt * Parser::CreateIntNode(int32 lw)
|
|
|
return pnode;
|
|
|
}
|
|
|
|
|
|
-ParseNodePid * Parser::CreateStrNode(IdentPtr pid)
|
|
|
+ParseNodeStr * Parser::CreateStrNode(IdentPtr pid)
|
|
|
{
|
|
|
Assert(!this->m_deferringAST);
|
|
|
- ParseNodePid * pnode = Anew(&m_nodeAllocator, ParseNodePid, knopStr, this->GetScanner()->IchMinTok(), this->GetScanner()->IchLimTok(), pid);
|
|
|
+ ParseNodeStr * pnode = Anew(&m_nodeAllocator, ParseNodeStr, this->GetScanner()->IchMinTok(), this->GetScanner()->IchLimTok(), pid);
|
|
|
pnode->grfpn |= PNodeFlags::fpnCanFlattenConcatExpr;
|
|
|
- AddAstSize(sizeof(ParseNodePid));
|
|
|
+ AddAstSize(sizeof(ParseNodeStr));
|
|
|
return pnode;
|
|
|
}
|
|
|
|
|
|
-ParseNodePid * Parser::CreateNameNode(IdentPtr pid)
|
|
|
+ParseNodeName * Parser::CreateNameNode(IdentPtr pid)
|
|
|
{
|
|
|
- ParseNodePid * pnode = Anew(&m_nodeAllocator, ParseNodePid, knopName, this->GetScanner()->IchMinTok(), this->GetScanner()->IchLimTok(), pid);
|
|
|
- AddAstSizeAllowDefer(sizeof(ParseNodePid));
|
|
|
+ ParseNodeName * pnode = Anew(&m_nodeAllocator, ParseNodeName, this->GetScanner()->IchMinTok(), this->GetScanner()->IchLimTok(), pid);
|
|
|
+ AddAstSizeAllowDefer(sizeof(ParseNodeName));
|
|
|
return pnode;
|
|
|
}
|
|
|
|
|
|
-ParseNodePid * Parser::CreateNameNode(IdentPtr pid, PidRefStack * ref, charcount_t ichMin, charcount_t ichLim)
|
|
|
+ParseNodeName * Parser::CreateNameNode(IdentPtr pid, PidRefStack * ref, charcount_t ichMin, charcount_t ichLim)
|
|
|
{
|
|
|
- ParseNodePid * pnode = Anew(&m_nodeAllocator, ParseNodePid, knopName, ichMin, ichLim, pid);
|
|
|
+ ParseNodeName * pnode = Anew(&m_nodeAllocator, ParseNodeName, ichMin, ichLim, pid);
|
|
|
pnode->SetSymRef(ref);
|
|
|
- AddAstSize(sizeof(ParseNodePid));
|
|
|
+ AddAstSize(sizeof(ParseNodeName));
|
|
|
return pnode;
|
|
|
}
|
|
|
|
|
|
@@ -946,7 +946,6 @@ ParseNodeSpecialName * Parser::CreateSpecialNameNode(IdentPtr pid, PidRefStack *
|
|
|
Assert(!this->m_deferringAST);
|
|
|
ParseNodeSpecialName * pnode = Anew(&m_nodeAllocator, ParseNodeSpecialName, ichMin, ichLim, pid);
|
|
|
pnode->SetSymRef(ref);
|
|
|
-
|
|
|
if (pid == wellKnownPropertyPids._this)
|
|
|
{
|
|
|
pnode->isThis = true;
|
|
|
@@ -1283,33 +1282,6 @@ void Parser::RestorePidRefForSym(Symbol *sym)
|
|
|
ref->SetSym(sym);
|
|
|
}
|
|
|
|
|
|
-IdentPtr Parser::PidFromNode(ParseNodePtr pnode)
|
|
|
-{
|
|
|
- for (;;)
|
|
|
- {
|
|
|
- switch (pnode->nop)
|
|
|
- {
|
|
|
- case knopName:
|
|
|
- return pnode->AsParseNodePid()->pid;
|
|
|
-
|
|
|
- case knopVarDecl:
|
|
|
- return pnode->AsParseNodeVar()->pid;
|
|
|
-
|
|
|
- case knopDot:
|
|
|
- Assert(pnode->AsParseNodeBin()->pnode2->nop == knopName);
|
|
|
- return pnode->AsParseNodeBin()->pnode2->AsParseNodePid()->pid;
|
|
|
-
|
|
|
- case knopComma:
|
|
|
- // Advance to the RHS and iterate.
|
|
|
- pnode = pnode->AsParseNodeBin()->pnode2;
|
|
|
- break;
|
|
|
-
|
|
|
- default:
|
|
|
- return nullptr;
|
|
|
- }
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
void Parser::CheckPidIsValid(IdentPtr pid, bool autoArgumentsObject)
|
|
|
{
|
|
|
if (IsStrictMode())
|
|
|
@@ -1710,7 +1682,7 @@ void Parser::BindPidRefs(BlockInfoStack *blockInfo, uint maxBlockId)
|
|
|
this->BindPidRefsInScope(pid, sym, blockId, maxBlockId);
|
|
|
break;
|
|
|
case knopName:
|
|
|
- pid = pnode->AsParseNodePid()->pid;
|
|
|
+ pid = pnode->AsParseNodeName()->pid;
|
|
|
if (backgroundPidRef)
|
|
|
{
|
|
|
pid = this->GetHashTbl()->FindExistingPid(pid->Psz(), pid->Psz() + pid->Cch(), pid->Cch(), pid->Hash(), nullptr, nullptr
|
|
|
@@ -2474,12 +2446,12 @@ void Parser::ParseImportClause(ModuleImportOrExportEntryList* importEntryList, b
|
|
|
|
|
|
bool Parser::IsImportOrExportStatementValidHere()
|
|
|
{
|
|
|
- ParseNodePtr curFunc = GetCurrentFunctionNode();
|
|
|
+ ParseNodeFnc * curFunc = GetCurrentFunctionNode();
|
|
|
|
|
|
// Import must be located in the top scope of the module body.
|
|
|
return curFunc->nop == knopFncDecl
|
|
|
- && curFunc->AsParseNodeFnc()->IsModule()
|
|
|
- && this->m_currentBlockInfo->pnodeBlock == curFunc->AsParseNodeFnc()->pnodeBodyScope
|
|
|
+ && curFunc->IsModule()
|
|
|
+ && this->m_currentBlockInfo->pnodeBlock == curFunc->pnodeBodyScope
|
|
|
&& (this->m_grfscr & fscrEvalCode) != fscrEvalCode
|
|
|
&& this->m_tryCatchOrFinallyDepth == 0
|
|
|
&& !this->m_disallowImportExportStmt;
|
|
|
@@ -2487,8 +2459,8 @@ bool Parser::IsImportOrExportStatementValidHere()
|
|
|
|
|
|
bool Parser::IsTopLevelModuleFunc()
|
|
|
{
|
|
|
- ParseNodePtr curFunc = GetCurrentFunctionNode();
|
|
|
- return curFunc->nop == knopFncDecl && curFunc->AsParseNodeFnc()->IsModule();
|
|
|
+ ParseNodeFnc * curFunc = GetCurrentFunctionNode();
|
|
|
+ return curFunc->nop == knopFncDecl && curFunc->IsModule();
|
|
|
}
|
|
|
|
|
|
template<bool buildAST> ParseNodePtr Parser::ParseImportCall()
|
|
|
@@ -2639,14 +2611,15 @@ ParseNodePtr Parser::ParseDefaultExportClause()
|
|
|
}
|
|
|
|
|
|
this->GetScanner()->SeekTo(parsedClass);
|
|
|
- pnode = ParseClassDecl<buildAST>(classHasName, nullptr, nullptr, nullptr);
|
|
|
+ ParseNodeClass * pnodeClass;
|
|
|
+ pnode = pnodeClass = ParseClassDecl<buildAST>(classHasName, nullptr, nullptr, nullptr);
|
|
|
|
|
|
if (buildAST)
|
|
|
{
|
|
|
AnalysisAssert(pnode != nullptr);
|
|
|
Assert(pnode->nop == knopClassDecl);
|
|
|
|
|
|
- pnode->AsParseNodeClass()->SetIsDefaultModuleExport(true);
|
|
|
+ pnodeClass->SetIsDefaultModuleExport(true);
|
|
|
}
|
|
|
|
|
|
break;
|
|
|
@@ -2732,7 +2705,8 @@ ParseNodePtr Parser::ParseDefaultExportClause()
|
|
|
|
|
|
// Mark this node as the default module export. We need to make sure it is put into the correct
|
|
|
// module export slot when we emit the node.
|
|
|
- pnode = CreateNodeForOpT<knopExportDefault>();
|
|
|
+ ParseNodeExportDefault * pnodeExportDefault;
|
|
|
+ pnode = pnodeExportDefault = CreateNodeForOpT<knopExportDefault>();
|
|
|
pnode->AsParseNodeExportDefault()->pnodeExpr = pnodeExpression;
|
|
|
}
|
|
|
break;
|
|
|
@@ -2915,8 +2889,9 @@ ParseNodePtr Parser::ParseExportDeclaration(bool *needTerminator)
|
|
|
{
|
|
|
Assert(pnode->nop == knopFncDecl);
|
|
|
|
|
|
- pnode->AsParseNodeFnc()->GetFuncSymbol()->SetIsModuleExportStorage(true);
|
|
|
- localName = pnode->AsParseNodeFnc()->pid;
|
|
|
+ ParseNodeFnc * pnodeFnc = pnode->AsParseNodeFnc();
|
|
|
+ pnodeFnc->GetFuncSymbol()->SetIsModuleExportStorage(true);
|
|
|
+ localName = pnodeFnc->pid;
|
|
|
}
|
|
|
Assert(localName != nullptr);
|
|
|
|
|
|
@@ -3024,7 +2999,7 @@ ParseNodePtr Parser::ParseTerm(BOOL fAllowCall,
|
|
|
isSpecialName = false;
|
|
|
|
|
|
LIdentifier:
|
|
|
- PidRefStack *ref = nullptr;
|
|
|
+ PidRefStack * ref = nullptr;
|
|
|
|
|
|
// Don't push a reference if this is a single lambda parameter, because we'll reparse with
|
|
|
// a correct function ID.
|
|
|
@@ -3189,9 +3164,10 @@ ParseNodePtr Parser::ParseTerm(BOOL fAllowCall,
|
|
|
|
|
|
if (buildAST)
|
|
|
{
|
|
|
- pnode = CreateNodeForOpT<knopFlt>();
|
|
|
- pnode->AsParseNodeFloat()->dbl = m_token.GetDouble();
|
|
|
- pnode->AsParseNodeFloat()->maybeInt = m_token.GetDoubleMayBeInt();
|
|
|
+ ParseNodeFloat * pnodeFloat;
|
|
|
+ pnode = pnodeFloat = CreateNodeForOpT<knopFlt>();
|
|
|
+ pnodeFloat->dbl = m_token.GetDouble();
|
|
|
+ pnodeFloat->maybeInt = m_token.GetDoubleMayBeInt();
|
|
|
}
|
|
|
fCanAssign = FALSE;
|
|
|
this->GetScanner()->Scan();
|
|
|
@@ -3504,19 +3480,19 @@ ParseNodeRegExp * Parser::ParseRegExp()
|
|
|
BOOL Parser::NodeIsEvalName(ParseNodePtr pnode)
|
|
|
{
|
|
|
//WOOB 1107758 Special case of indirect eval binds to local scope in standards mode
|
|
|
- return pnode->nop == knopName && (pnode->AsParseNodePid()->pid == wellKnownPropertyPids.eval);
|
|
|
+ return pnode->nop == knopName && (pnode->AsParseNodeName()->pid == wellKnownPropertyPids.eval);
|
|
|
}
|
|
|
|
|
|
BOOL Parser::NodeIsSuperName(ParseNodePtr pnode)
|
|
|
{
|
|
|
- return pnode->nop == knopName && (pnode->AsParseNodePid()->pid == wellKnownPropertyPids._superConstructor);
|
|
|
+ return pnode->nop == knopName && (pnode->AsParseNodeName()->pid == wellKnownPropertyPids._superConstructor);
|
|
|
}
|
|
|
|
|
|
BOOL Parser::NodeEqualsName(ParseNodePtr pnode, LPCOLESTR sz, uint32 cch)
|
|
|
{
|
|
|
return pnode->nop == knopName &&
|
|
|
- pnode->AsParseNodePid()->pid->Cch() == cch &&
|
|
|
- !wmemcmp(pnode->AsParseNodePid()->pid->Psz(), sz, cch);
|
|
|
+ pnode->AsParseNodeName()->pid->Cch() == cch &&
|
|
|
+ !wmemcmp(pnode->AsParseNodeName()->pid->Psz(), sz, cch);
|
|
|
}
|
|
|
|
|
|
BOOL Parser::NodeIsIdent(ParseNodePtr pnode, IdentPtr pid)
|
|
|
@@ -3526,7 +3502,7 @@ BOOL Parser::NodeIsIdent(ParseNodePtr pnode, IdentPtr pid)
|
|
|
switch (pnode->nop)
|
|
|
{
|
|
|
case knopName:
|
|
|
- return (pnode->AsParseNodePid()->pid == pid);
|
|
|
+ return (pnode->AsParseNodeName()->pid == pid);
|
|
|
|
|
|
case knopComma:
|
|
|
pnode = pnode->AsParseNodeBin()->pnode2;
|
|
|
@@ -3702,7 +3678,8 @@ ParseNodePtr Parser::ParsePostfixOperators(
|
|
|
ParseNodePtr pnodeExpr = ParseExpr<buildAST>(0, FALSE, TRUE, FALSE, nullptr, nullptr, nullptr, &tok);
|
|
|
if (buildAST)
|
|
|
{
|
|
|
- if (pnode && pnode->nop == knopName && pnode->AsParseNodePid()->IsSpecialName() && pnode->AsParseNodeSpecialName()->isSuper)
|
|
|
+ AnalysisAssert(pnodeExpr);
|
|
|
+ if (pnode && pnode->nop == knopName && pnode->AsParseNodeName()->IsSpecialName() && pnode->AsParseNodeSpecialName()->isSuper)
|
|
|
{
|
|
|
pnode = CreateSuperReferenceNode(knopIndex, pnode->AsParseNodeSpecialName(), pnodeExpr);
|
|
|
pnode->AsParseNodeSuperReference()->pnodeThis = ReferenceSpecialName(wellKnownPropertyPids._this, pnode->ichMin, pnode->ichLim, true);
|
|
|
@@ -3735,7 +3712,7 @@ ParseNodePtr Parser::ParsePostfixOperators(
|
|
|
{
|
|
|
if (pnodeExpr && pnodeExpr->nop == knopName)
|
|
|
{
|
|
|
- topPidRef = pnodeExpr->AsParseNodePid()->pid->GetTopRef();
|
|
|
+ topPidRef = pnodeExpr->AsParseNodeName()->pid->GetTopRef();
|
|
|
}
|
|
|
}
|
|
|
else if (tok.tk == tkID)
|
|
|
@@ -3756,18 +3733,18 @@ ParseNodePtr Parser::ParsePostfixOperators(
|
|
|
if (pnode->AsParseNodeBin()->pnode2->nop == knopStr)
|
|
|
{
|
|
|
// if the string is empty or contains escape character, we will not convert them to dot node
|
|
|
- shouldConvertToDot = pnode->AsParseNodeBin()->pnode2->AsParseNodePid()->pid->Cch() > 0 && !this->GetScanner()->IsEscapeOnLastTkStrCon();
|
|
|
+ shouldConvertToDot = pnode->AsParseNodeBin()->pnode2->AsParseNodeStr()->pid->Cch() > 0 && !this->GetScanner()->IsEscapeOnLastTkStrCon();
|
|
|
}
|
|
|
|
|
|
if (shouldConvertToDot)
|
|
|
{
|
|
|
- LPCOLESTR str = pnode->AsParseNodeBin()->pnode2->AsParseNodePid()->pid->Psz();
|
|
|
+ LPCOLESTR str = pnode->AsParseNodeBin()->pnode2->AsParseNodeStr()->pid->Psz();
|
|
|
// See if we can convert o["p"] into o.p and o["0"] into o[0] since they're equivalent and the latter forms
|
|
|
// are faster
|
|
|
uint32 uintValue;
|
|
|
if (Js::JavascriptOperators::TryConvertToUInt32(
|
|
|
str,
|
|
|
- pnode->AsParseNodeBin()->pnode2->AsParseNodePid()->pid->Cch(),
|
|
|
+ pnode->AsParseNodeBin()->pnode2->AsParseNodeStr()->pid->Cch(),
|
|
|
&uintValue) &&
|
|
|
!Js::TaggedInt::IsOverflow(uintValue)) // the optimization is not very useful if the number can't be represented as a TaggedInt
|
|
|
{
|
|
|
@@ -3794,7 +3771,10 @@ ParseNodePtr Parser::ParsePostfixOperators(
|
|
|
|
|
|
if (doConvertToProperty)
|
|
|
{
|
|
|
- pnode->AsParseNodeBin()->pnode2->nop = knopName;
|
|
|
+ ParseNodeName * pnodeNewExpr = CreateNameNode(pnodeExpr->AsParseNodeStr()->pid);
|
|
|
+ pnodeNewExpr->ichMin = pnodeExpr->ichMin;
|
|
|
+ pnodeNewExpr->ichLim = pnodeExpr->ichLim;
|
|
|
+ pnode->AsParseNodeBin()->pnode2 = pnodeNewExpr;
|
|
|
pnode->nop = knopDot;
|
|
|
pnode->grfpn |= PNodeFlags::fpnIndexOperator;
|
|
|
}
|
|
|
@@ -3837,7 +3817,7 @@ ParseNodePtr Parser::ParsePostfixOperators(
|
|
|
Assert(opCode == knopIndex);
|
|
|
name = CreateStrNode(m_token.GetIdentifier(this->GetHashTbl()));
|
|
|
}
|
|
|
- if (pnode && pnode->nop == knopName && pnode->AsParseNodePid()->IsSpecialName() && pnode->AsParseNodeSpecialName()->isSuper)
|
|
|
+ if (pnode && pnode->nop == knopName && pnode->AsParseNodeName()->IsSpecialName() && pnode->AsParseNodeSpecialName()->isSuper)
|
|
|
{
|
|
|
pnode = CreateSuperReferenceNode(opCode, pnode->AsParseNodeSpecialName(), name);
|
|
|
pnode->AsParseNodeSuperReference()->pnodeThis = ReferenceSpecialName(wellKnownPropertyPids._this, pnode->ichMin, pnode->ichLim, true);
|
|
|
@@ -4608,7 +4588,7 @@ ParseNodePtr Parser::ParseMemberList(LPCOLESTR pNameHint, uint32* pNameHintLengt
|
|
|
pnodeArg = CreateBinNode(isObjectPattern ? knopObjectPatternMember : knopMember, pnodeName, pnodeExpr);
|
|
|
if (pnodeArg->pnode1->nop == knopStr)
|
|
|
{
|
|
|
- pnodeArg->pnode1->AsParseNodePid()->pid->PromoteAssignmentState();
|
|
|
+ pnodeArg->pnode1->AsParseNodeStr()->pid->PromoteAssignmentState();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -4747,9 +4727,10 @@ ParseNodePtr Parser::ParseMemberList(LPCOLESTR pNameHint, uint32* pNameHintLengt
|
|
|
if (pnodeArg->pnode2->nop == knopFncDecl)
|
|
|
{
|
|
|
Assert(fullNameHintLength >= shortNameOffset);
|
|
|
- pnodeArg->pnode2->AsParseNodeFnc()->hint = pFullNameHint;
|
|
|
- pnodeArg->pnode2->AsParseNodeFnc()->hintLength = fullNameHintLength;
|
|
|
- pnodeArg->pnode2->AsParseNodeFnc()->hintOffset = shortNameOffset;
|
|
|
+ ParseNodeFnc * pnodeFunc = pnodeArg->pnode2->AsParseNodeFnc();
|
|
|
+ pnodeFunc->hint = pFullNameHint;
|
|
|
+ pnodeFunc->hintLength = fullNameHintLength;
|
|
|
+ pnodeFunc->hintOffset = shortNameOffset;
|
|
|
}
|
|
|
AddToNodeListEscapedUse(&pnodeList, &lastNodeRef, pnodeArg);
|
|
|
}
|
|
|
@@ -4895,11 +4876,11 @@ ParseNode * Parser::ParseFncDecl(ushort flags, LPCOLESTR pNameHint, const bool n
|
|
|
// Create the node.
|
|
|
pnodeFnc = CreateAllowDeferNodeForOpT<knopFncDecl>();
|
|
|
pnodeFnc->SetDeclaration(fDeclaration);
|
|
|
-
|
|
|
- pnodeFnc->nestedFuncEscapes = false;
|
|
|
+
|
|
|
+ pnodeFnc->nestedFuncEscapes = false;
|
|
|
pnodeFnc->cbMin = this->GetScanner()->IecpMinTok();
|
|
|
pnodeFnc->functionId = (*m_nextFunctionId)++;
|
|
|
-
|
|
|
+
|
|
|
|
|
|
// Push new parser state with this new function node
|
|
|
|
|
|
@@ -6189,7 +6170,7 @@ ParseNodeFnc * Parser::CreateDummyFuncNode(bool fDeclaration)
|
|
|
|
|
|
ParseNodeFnc * pnodeFnc = CreateAllowDeferNodeForOpT<knopFncDecl>();
|
|
|
pnodeFnc->SetDeclaration(fDeclaration);
|
|
|
-
|
|
|
+
|
|
|
pnodeFnc->SetNested(m_currentNodeFunc != nullptr); // If there is a current function, then we're a nested function.
|
|
|
pnodeFnc->SetStrictMode(IsStrictMode()); // Inherit current strict mode -- may be overridden by the function itself if it contains a strict mode directive.
|
|
|
|
|
|
@@ -6782,11 +6763,11 @@ ParseNodeFnc * Parser::GenerateEmptyConstructor(bool extends)
|
|
|
pnodeFnc->ichLim = this->GetScanner()->IchLimTok();
|
|
|
pnodeFnc->ichMin = this->GetScanner()->IchMinTok();
|
|
|
pnodeFnc->cbLim = this->GetScanner()->IecpLimTok();
|
|
|
- pnodeFnc->cbMin = this->GetScanner()->IecpMinTok();
|
|
|
+ pnodeFnc->cbMin = this->GetScanner()->IecpMinTok();
|
|
|
pnodeFnc->lineNumber = this->GetScanner()->LineCur();
|
|
|
|
|
|
pnodeFnc->functionId = (*m_nextFunctionId);
|
|
|
-
|
|
|
+
|
|
|
// In order to (re-)defer the default constructor, we need to, for instance, track
|
|
|
// deferred class expression the way we track function expression, since we lose the part of the source
|
|
|
// that tells us which we have.
|
|
|
@@ -6834,7 +6815,7 @@ ParseNodeFnc * Parser::GenerateEmptyConstructor(bool extends)
|
|
|
ParseNodeFnc * pnodeFncSave = m_currentNodeFunc;
|
|
|
m_currentNodeFunc = pnodeFnc;
|
|
|
|
|
|
- ParseNodePid * argsId = nullptr;
|
|
|
+ ParseNodeName * argsId = nullptr;
|
|
|
ParseNodePtr *lastNodeRef = nullptr;
|
|
|
ParseNodeBlock * pnodeBlock = StartParseBlock<buildAST>(PnodeBlockType::Parameter, ScopeType_Parameter);
|
|
|
|
|
|
@@ -7450,7 +7431,7 @@ public:
|
|
|
this->m_parser->m_parsingSuperRestrictionState = m_originalParsingSuperRestrictionState;
|
|
|
}
|
|
|
private:
|
|
|
- Parser* m_parser;
|
|
|
+ Parser * m_parser;
|
|
|
int m_originalParsingSuperRestrictionState;
|
|
|
};
|
|
|
|
|
|
@@ -7864,9 +7845,10 @@ ParseNodePtr Parser::ParseStringTemplateDecl(ParseNodePtr pnodeTagFnc)
|
|
|
ParseNodePtr* lastSubstitutionExpressionNodeRef = nullptr;
|
|
|
ParseNodePtr pnodeTagFncArgs = nullptr;
|
|
|
ParseNodePtr* lastTagFncArgNodeRef = nullptr;
|
|
|
- ParseNodePid * stringLiteral = nullptr;
|
|
|
- ParseNodePid * stringLiteralRaw = nullptr;
|
|
|
- ParseNodePtr pnodeStringTemplate = nullptr;
|
|
|
+ ParseNodeStr * stringLiteral = nullptr;
|
|
|
+ ParseNodeStr * stringLiteralRaw = nullptr;
|
|
|
+ ParseNodeStrTemplate * pnodeStringTemplate = nullptr;
|
|
|
+ ParseNode * pnodeReturn = nullptr;
|
|
|
bool templateClosed = false;
|
|
|
const bool isTagged = pnodeTagFnc != nullptr;
|
|
|
uint16 stringConstantCount = 0;
|
|
|
@@ -7876,9 +7858,9 @@ ParseNodePtr Parser::ParseStringTemplateDecl(ParseNodePtr pnodeTagFnc)
|
|
|
|
|
|
if (buildAST)
|
|
|
{
|
|
|
- pnodeStringTemplate = CreateNodeForOpT<knopStrTemplate>();
|
|
|
- pnodeStringTemplate->AsParseNodeStrTemplate()->countStringLiterals = 0;
|
|
|
- pnodeStringTemplate->AsParseNodeStrTemplate()->isTaggedTemplate = isTagged ? TRUE : FALSE;
|
|
|
+ pnodeReturn = pnodeStringTemplate = CreateNodeForOpT<knopStrTemplate>();
|
|
|
+ pnodeStringTemplate->countStringLiterals = 0;
|
|
|
+ pnodeStringTemplate->isTaggedTemplate = isTagged ? TRUE : FALSE;
|
|
|
|
|
|
// If this is a tagged string template, we need to start building the arg list for the call
|
|
|
if (isTagged)
|
|
|
@@ -8014,10 +7996,10 @@ ParseNodePtr Parser::ParseStringTemplateDecl(ParseNodePtr pnodeTagFnc)
|
|
|
|
|
|
if (buildAST)
|
|
|
{
|
|
|
- pnodeStringTemplate->AsParseNodeStrTemplate()->pnodeStringLiterals = pnodeStringLiterals;
|
|
|
- pnodeStringTemplate->AsParseNodeStrTemplate()->pnodeStringRawLiterals = pnodeRawStringLiterals;
|
|
|
- pnodeStringTemplate->AsParseNodeStrTemplate()->pnodeSubstitutionExpressions = pnodeSubstitutionExpressions;
|
|
|
- pnodeStringTemplate->AsParseNodeStrTemplate()->countStringLiterals = stringConstantCount;
|
|
|
+ pnodeStringTemplate->pnodeStringLiterals = pnodeStringLiterals;
|
|
|
+ pnodeStringTemplate->pnodeStringRawLiterals = pnodeRawStringLiterals;
|
|
|
+ pnodeStringTemplate->pnodeSubstitutionExpressions = pnodeSubstitutionExpressions;
|
|
|
+ pnodeStringTemplate->countStringLiterals = stringConstantCount;
|
|
|
|
|
|
// We should still have the last string literal.
|
|
|
// Use the char offset of the end of that constant as the end of the string template.
|
|
|
@@ -8027,17 +8009,18 @@ ParseNodePtr Parser::ParseStringTemplateDecl(ParseNodePtr pnodeTagFnc)
|
|
|
if (isTagged)
|
|
|
{
|
|
|
// Return the call node here and let the byte code generator Emit the string template automagically
|
|
|
- pnodeStringTemplate = CreateCallNode(knopCall, pnodeTagFnc, pnodeTagFncArgs, ichMin, pnodeStringTemplate->ichLim);
|
|
|
+ ParseNodeCall * pnodeCall;
|
|
|
+ pnodeReturn = pnodeCall = CreateCallNode(knopCall, pnodeTagFnc, pnodeTagFncArgs, ichMin, pnodeStringTemplate->ichLim);
|
|
|
|
|
|
// We need to set the arg count explicitly
|
|
|
- pnodeStringTemplate->AsParseNodeCall()->argCount = stringConstantCount;
|
|
|
- pnodeStringTemplate->AsParseNodeCall()->hasDestructuring = m_hasDestructuringPattern;
|
|
|
+ pnodeCall->argCount = stringConstantCount;
|
|
|
+ pnodeCall->hasDestructuring = m_hasDestructuringPattern;
|
|
|
}
|
|
|
}
|
|
|
|
|
|
this->GetScanner()->Scan();
|
|
|
|
|
|
- return pnodeStringTemplate;
|
|
|
+ return pnodeReturn;
|
|
|
}
|
|
|
|
|
|
LPCOLESTR Parser::FormatPropertyString(LPCOLESTR propertyString, ParseNodePtr pNode, uint32 *fullNameHintLength, uint32 *pShortNameOffset)
|
|
|
@@ -8058,7 +8041,7 @@ LPCOLESTR Parser::FormatPropertyString(LPCOLESTR propertyString, ParseNodePtr pN
|
|
|
}
|
|
|
else if (op == knopStr)
|
|
|
{
|
|
|
- return AppendNameHints(propertyString, pNode->AsParseNodePid()->pid, fullNameHintLength, pShortNameOffset, false, true/*add brackets*/);
|
|
|
+ return AppendNameHints(propertyString, pNode->AsParseNodeStr()->pid, fullNameHintLength, pShortNameOffset, false, true/*add brackets*/);
|
|
|
}
|
|
|
else if (op == knopFlt)
|
|
|
{
|
|
|
@@ -8067,7 +8050,7 @@ LPCOLESTR Parser::FormatPropertyString(LPCOLESTR propertyString, ParseNodePtr pN
|
|
|
else
|
|
|
{
|
|
|
rightNode = op == knopInt ? this->GetScanner()->StringFromLong(pNode->AsParseNodeInt()->lw)
|
|
|
- : pNode->AsParseNodePid()->pid->Psz();
|
|
|
+ : pNode->AsParseNodeName()->pid->Psz();
|
|
|
}
|
|
|
|
|
|
return AppendNameHints(propertyString, rightNode, fullNameHintLength, pShortNameOffset, false, true/*add brackets*/);
|
|
|
@@ -8090,7 +8073,7 @@ LPCOLESTR Parser::ConstructNameHint(ParseNodeBin * pNode, uint32* fullNameHintLe
|
|
|
{
|
|
|
leftNode = ConstructNameHint(pNode->pnode1->AsParseNodeBin(), fullNameHintLength, pShortNameOffset);
|
|
|
}
|
|
|
- else if (pNode->pnode1->nop == knopName && !pNode->pnode1->AsParseNodePid()->IsSpecialName())
|
|
|
+ else if (pNode->pnode1->nop == knopName && !pNode->pnode1->AsParseNodeName()->IsSpecialName())
|
|
|
{
|
|
|
// We need to skip special names like 'this' because those shouldn't be appended to the
|
|
|
// name hint in the debugger stack trace.
|
|
|
@@ -8100,7 +8083,7 @@ LPCOLESTR Parser::ConstructNameHint(ParseNodeBin * pNode, uint32* fullNameHintLe
|
|
|
// }
|
|
|
// }
|
|
|
|
|
|
- IdentPtr pid = pNode->pnode1->AsParseNodePid()->pid;
|
|
|
+ IdentPtr pid = pNode->pnode1->AsParseNodeName()->pid;
|
|
|
leftNode = pid->Psz();
|
|
|
*fullNameHintLength = pid->Cch();
|
|
|
*pShortNameOffset = 0;
|
|
|
@@ -8123,7 +8106,7 @@ LPCOLESTR Parser::ConstructNameHint(ParseNodeBin * pNode, uint32* fullNameHintLe
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- rightNode = pNode->pnode2->AsParseNodePid()->pid->Psz();
|
|
|
+ rightNode = pNode->pnode2->AsParseNodeName()->pid->Psz();
|
|
|
wrapWithBrackets = PNodeFlags::fpnIndexOperator == (pNode->grfpn & PNodeFlags::fpnIndexOperator);
|
|
|
}
|
|
|
Assert(rightNode != nullptr);
|
|
|
@@ -8544,7 +8527,7 @@ ParseNodePtr Parser::ParseExpr(int oplMin,
|
|
|
{
|
|
|
if (IsStrictMode() && pnodeT->nop == knopName)
|
|
|
{
|
|
|
- CheckStrictModeEvalArgumentsUsage(pnodeT->AsParseNodePid()->pid);
|
|
|
+ CheckStrictModeEvalArgumentsUsage(pnodeT->AsParseNodeName()->pid);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
@@ -8671,7 +8654,7 @@ ParseNodePtr Parser::ParseExpr(int oplMin,
|
|
|
pNameHint = NULL;
|
|
|
if (pnode->nop == knopName)
|
|
|
{
|
|
|
- IdentPtr pid = pnode->AsParseNodePid()->pid;
|
|
|
+ IdentPtr pid = pnode->AsParseNodeName()->pid;
|
|
|
pNameHint = pid->Psz();
|
|
|
hintLength = pid->Cch();
|
|
|
hintOffset = 0;
|
|
|
@@ -8680,7 +8663,7 @@ ParseNodePtr Parser::ParseExpr(int oplMin,
|
|
|
{
|
|
|
if (CONFIG_FLAG(UseFullName))
|
|
|
{
|
|
|
- pNameHint = ConstructNameHint(pnode->AsParseNodeBin() , &hintLength, &hintOffset);
|
|
|
+ pNameHint = ConstructNameHint(pnode->AsParseNodeBin(), &hintLength, &hintOffset);
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
@@ -8692,7 +8675,7 @@ ParseNodePtr Parser::ParseExpr(int oplMin,
|
|
|
|
|
|
if (pnodeName->nop == knopName)
|
|
|
{
|
|
|
- IdentPtr pid = pnode->AsParseNodePid()->pid;
|
|
|
+ IdentPtr pid = pnode->AsParseNodeName()->pid;
|
|
|
pNameHint = pid->Psz();
|
|
|
hintLength = pid->Cch();
|
|
|
hintOffset = 0;
|
|
|
@@ -8715,7 +8698,7 @@ ParseNodePtr Parser::ParseExpr(int oplMin,
|
|
|
{
|
|
|
if (IsStrictMode() && pnode->nop == knopName)
|
|
|
{
|
|
|
- CheckStrictModeEvalArgumentsUsage(pnode->AsParseNodePid()->pid);
|
|
|
+ CheckStrictModeEvalArgumentsUsage(pnode->AsParseNodeName()->pid);
|
|
|
}
|
|
|
this->CheckArguments(pnode);
|
|
|
pnode = CreateUniNode(tkInc == m_token.tk ? knopIncPost : knopDecPost, pnode);
|
|
|
@@ -8762,17 +8745,17 @@ ParseNodePtr Parser::ParseExpr(int oplMin,
|
|
|
{
|
|
|
if (IsStrictMode() && pnode->nop == knopName)
|
|
|
{
|
|
|
- CheckStrictModeEvalArgumentsUsage(pnode->AsParseNodePid()->pid);
|
|
|
+ CheckStrictModeEvalArgumentsUsage(pnode->AsParseNodeName()->pid);
|
|
|
}
|
|
|
|
|
|
// Assignment stmt of the form "this.<id> = <expr>"
|
|
|
if (nop == knopAsg
|
|
|
&& pnode->nop == knopDot
|
|
|
&& pnode->AsParseNodeBin()->pnode1->nop == knopName
|
|
|
- && pnode->AsParseNodeBin()->pnode1->AsParseNodePid()->pid == wellKnownPropertyPids._this
|
|
|
+ && pnode->AsParseNodeBin()->pnode1->AsParseNodeName()->pid == wellKnownPropertyPids._this
|
|
|
&& pnode->AsParseNodeBin()->pnode2->nop == knopName)
|
|
|
{
|
|
|
- if (pnode->AsParseNodeBin()->pnode2->AsParseNodePid()->pid != wellKnownPropertyPids.__proto__)
|
|
|
+ if (pnode->AsParseNodeBin()->pnode2->AsParseNodeName()->pid != wellKnownPropertyPids.__proto__)
|
|
|
{
|
|
|
assignmentStmt = true;
|
|
|
}
|
|
|
@@ -8904,7 +8887,7 @@ ParseNodePtr Parser::ParseExpr(int oplMin,
|
|
|
}
|
|
|
else if (pnode->AsParseNodeBin()->pnode1->nop == knopName)
|
|
|
{
|
|
|
- PidRefStack *pidRef = pnode->AsParseNodeBin()->pnode1->AsParseNodePid()->pid->GetTopRef();
|
|
|
+ PidRefStack *pidRef = pnode->AsParseNodeBin()->pnode1->AsParseNodeName()->pid->GetTopRef();
|
|
|
pidRef->isFuncAssignment = true;
|
|
|
}
|
|
|
}
|
|
|
@@ -8988,7 +8971,7 @@ ParseNodePtr Parser::ParseExpr(int oplMin,
|
|
|
ParseNodePtr propertyNode = lhs->AsParseNodeBin()->pnode2;
|
|
|
if (propertyNode->nop == knopName)
|
|
|
{
|
|
|
- propertyNode->AsParseNodePid()->pid->PromoteAssignmentState();
|
|
|
+ propertyNode->AsParseNodeName()->pid->PromoteAssignmentState();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -9001,7 +8984,7 @@ ParseNodePtr Parser::ParseExpr(int oplMin,
|
|
|
ParseNodePtr propertyNode = lhs->AsParseNodeBin()->pnode2;
|
|
|
if (propertyNode->nop == knopName)
|
|
|
{
|
|
|
- propertyNode->AsParseNodePid()->pid->PromoteAssignmentState();
|
|
|
+ propertyNode->AsParseNodeName()->pid->PromoteAssignmentState();
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -9018,7 +9001,7 @@ void Parser::TrackAssignment(ParseNodePtr pnodeT, IdentToken* pToken)
|
|
|
Assert(pnodeT != nullptr);
|
|
|
if (pnodeT->nop == knopName)
|
|
|
{
|
|
|
- PidRefStack *ref = pnodeT->AsParseNodePid()->pid->GetTopRef();
|
|
|
+ PidRefStack *ref = pnodeT->AsParseNodeName()->pid->GetTopRef();
|
|
|
Assert(ref);
|
|
|
ref->isAsg = true;
|
|
|
}
|
|
|
@@ -9035,27 +9018,6 @@ void Parser::TrackAssignment(ParseNodePtr pnodeT, IdentToken* pToken)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-void ParseNodePid::SetSymRef(PidRefStack *ref)
|
|
|
-{
|
|
|
- Assert(symRef == nullptr);
|
|
|
- this->symRef = ref->GetSymRef();
|
|
|
-}
|
|
|
-
|
|
|
-Js::PropertyId ParseNodePid::PropertyIdFromNameNode() const
|
|
|
-{
|
|
|
- Js::PropertyId propertyId;
|
|
|
- Symbol *sym = this->sym;
|
|
|
- if (sym)
|
|
|
- {
|
|
|
- propertyId = sym->GetPosition();
|
|
|
- }
|
|
|
- else
|
|
|
- {
|
|
|
- propertyId = this->pid->GetPropertyId();
|
|
|
- }
|
|
|
- return propertyId;
|
|
|
-}
|
|
|
-
|
|
|
PidRefStack* Parser::PushPidRef(IdentPtr pid)
|
|
|
{
|
|
|
if (PHASE_ON1(Js::ParallelParsePhase))
|
|
|
@@ -9516,7 +9478,7 @@ ParseNodeCatch * Parser::ParseCatch()
|
|
|
ParseNodePtr pnodePattern = ParseDestructuredLiteral<buildAST>(tkLET, true /*isDecl*/, true /*topLevel*/, DIC_ForceErrorOnInitializer);
|
|
|
if (buildAST)
|
|
|
{
|
|
|
- pnode->pnodeParam = CreateParamPatternNode(pnodePattern);
|
|
|
+ pnode->SetParam(CreateParamPatternNode(pnodePattern));
|
|
|
Scope *scope = pnodeCatchScope->scope;
|
|
|
pnode->scope = scope;
|
|
|
}
|
|
|
@@ -9539,8 +9501,8 @@ ParseNodeCatch * Parser::ParseCatch()
|
|
|
pidCatch = m_token.GetIdentifier(this->GetHashTbl());
|
|
|
PidRefStack *ref = this->FindOrAddPidRef(pidCatch, GetCurrentBlock()->blockId, GetCurrentFunctionNode()->functionId);
|
|
|
|
|
|
- ParseNodePid * pnodeParam = CreateNameNode(pidCatch);
|
|
|
- pnodeParam->symRef = ref->GetSymRef();
|
|
|
+ ParseNodeName * pnodeParam = CreateNameNode(pidCatch);
|
|
|
+ pnodeParam->SetSymRef(ref);
|
|
|
|
|
|
const char16 *name = reinterpret_cast<const char16*>(pidCatch->Psz());
|
|
|
int nameLength = pidCatch->Cch();
|
|
|
@@ -9559,7 +9521,7 @@ ParseNodeCatch * Parser::ParseCatch()
|
|
|
|
|
|
if (buildAST)
|
|
|
{
|
|
|
- pnode->pnodeParam = pnodeParam;
|
|
|
+ pnode->SetParam(pnodeParam);
|
|
|
pnode->scope = scope;
|
|
|
}
|
|
|
|
|
|
@@ -10748,7 +10710,7 @@ LNeedTerminator:
|
|
|
const WCHAR *uniqueNameStr = _u("__ehobj");
|
|
|
IdentPtr uniqueName = this->GetHashTbl()->PidHashNameLen(uniqueNameStr, static_cast<int32>(wcslen(uniqueNameStr)));
|
|
|
|
|
|
- pCatch->pnodeParam = CreateNameNode(uniqueName);
|
|
|
+ pCatch->SetParam(CreateNameNode(uniqueName));
|
|
|
|
|
|
// Add this catch to the current list. We don't bother adjusting the catch and function expression
|
|
|
// lists here because the catch is just an empty statement.
|
|
|
@@ -11283,7 +11245,7 @@ void Parser::FinishScopeInfo(Js::ScopeInfo * scopeInfo)
|
|
|
/***************************************************************************
|
|
|
Parse the code.
|
|
|
***************************************************************************/
|
|
|
-ParseNodePtr Parser::Parse(LPCUTF8 pszSrc, size_t offset, size_t length, charcount_t charOffset, bool isUtf8, ULONG grfscr, ULONG lineNumber, Js::LocalFunctionId * nextFunctionId, CompileScriptException *pse)
|
|
|
+ParseNodeProg * Parser::Parse(LPCUTF8 pszSrc, size_t offset, size_t length, charcount_t charOffset, bool isUtf8, ULONG grfscr, ULONG lineNumber, Js::LocalFunctionId * nextFunctionId, CompileScriptException *pse)
|
|
|
{
|
|
|
ParseNodeProg * pnodeProg;
|
|
|
ParseNodePtr *lastNodeRef = nullptr;
|
|
|
@@ -11399,7 +11361,7 @@ ParseNodePtr Parser::Parse(LPCUTF8 pszSrc, size_t offset, size_t length, charcou
|
|
|
if (scopeInfo)
|
|
|
{
|
|
|
// Create an enclosing function context.
|
|
|
- m_currentNodeFunc = CreateNodeForOpT<knopFncDecl>();
|
|
|
+ m_currentNodeFunc = CreateNodeForOpT<knopFncDecl>();
|
|
|
m_currentNodeFunc->functionId = m_functionBody->GetLocalFunctionId();
|
|
|
m_currentNodeFunc->nestedCount = m_functionBody->GetNestedCount();
|
|
|
m_currentNodeFunc->SetStrictMode(!!this->m_fUseStrictMode);
|
|
|
@@ -11732,7 +11694,7 @@ bool Parser::CheckAsmjsModeStrPid(IdentPtr pid)
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
-HRESULT Parser::ParseUtf8Source(__out ParseNodePtr* parseTree, LPCUTF8 pSrc, size_t length, ULONG grfsrc, CompileScriptException *pse,
|
|
|
+HRESULT Parser::ParseUtf8Source(__out ParseNodeProg ** parseTree, LPCUTF8 pSrc, size_t length, ULONG grfsrc, CompileScriptException *pse,
|
|
|
Js::LocalFunctionId * nextFunctionId, SourceContextInfo * sourceContextInfo)
|
|
|
{
|
|
|
m_functionBody = nullptr;
|
|
|
@@ -11740,7 +11702,7 @@ HRESULT Parser::ParseUtf8Source(__out ParseNodePtr* parseTree, LPCUTF8 pSrc, siz
|
|
|
return ParseSourceInternal(parseTree, pSrc, 0, length, 0, true, grfsrc, pse, nextFunctionId, 0, sourceContextInfo);
|
|
|
}
|
|
|
|
|
|
-HRESULT Parser::ParseCesu8Source(__out ParseNodePtr* parseTree, LPCUTF8 pSrc, size_t length, ULONG grfsrc, CompileScriptException *pse,
|
|
|
+HRESULT Parser::ParseCesu8Source(__out ParseNodeProg ** parseTree, LPCUTF8 pSrc, size_t length, ULONG grfsrc, CompileScriptException *pse,
|
|
|
Js::LocalFunctionId * nextFunctionId, SourceContextInfo * sourceContextInfo)
|
|
|
{
|
|
|
m_functionBody = nullptr;
|
|
|
@@ -11896,7 +11858,7 @@ HRESULT Parser::ParseFunctionInBackground(ParseNodeFnc * pnodeFnc, ParseContext
|
|
|
|
|
|
#endif
|
|
|
|
|
|
-HRESULT Parser::ParseSourceWithOffset(__out ParseNodePtr* parseTree, LPCUTF8 pSrc, size_t offset, size_t cbLength, charcount_t cchOffset,
|
|
|
+HRESULT Parser::ParseSourceWithOffset(__out ParseNodeProg ** parseTree, LPCUTF8 pSrc, size_t offset, size_t cbLength, charcount_t cchOffset,
|
|
|
bool isCesu8, ULONG grfscr, CompileScriptException *pse, Js::LocalFunctionId * nextFunctionId, ULONG lineNumber, SourceContextInfo * sourceContextInfo,
|
|
|
Js::ParseableFunctionInfo* functionInfo)
|
|
|
{
|
|
|
@@ -12010,10 +11972,10 @@ ParseNode* Parser::CopyPnode(ParseNode *pnode) {
|
|
|
switch (pnode->nop) {
|
|
|
//PTNODE(knopName , "name" ,None ,Pid ,fnopLeaf)
|
|
|
case knopName: {
|
|
|
- ParseNodePid * nameNode = CreateNameNode(pnode->AsParseNodePid()->pid);
|
|
|
+ ParseNodeName * nameNode = CreateNameNode(pnode->AsParseNodeName()->pid);
|
|
|
nameNode->ichMin = pnode->ichMin;
|
|
|
nameNode->ichLim = pnode->ichLim;
|
|
|
- nameNode->sym = pnode->AsParseNodePid()->sym;
|
|
|
+ nameNode->sym = pnode->AsParseNodeName()->sym;
|
|
|
return nameNode;
|
|
|
}
|
|
|
//PTNODE(knopInt , "int const" ,None ,Int ,fnopLeaf|fnopConst)
|
|
|
@@ -12318,7 +12280,7 @@ inline bool Parser::IsNaNOrInfinityLiteral(LPCOLESTR str)
|
|
|
template <bool buildAST>
|
|
|
IdentPtr Parser::ParseSuper(bool fAllowCall)
|
|
|
{
|
|
|
- ParseNodePtr currentNodeFunc = GetCurrentFunctionNode();
|
|
|
+ ParseNodeFnc * currentNodeFunc = GetCurrentFunctionNode();
|
|
|
IdentPtr superPid = nullptr;
|
|
|
|
|
|
switch (m_token.tk)
|
|
|
@@ -12336,7 +12298,7 @@ IdentPtr Parser::ParseSuper(bool fAllowCall)
|
|
|
break;
|
|
|
}
|
|
|
|
|
|
- currentNodeFunc->AsParseNodeFnc()->SetHasSuperReference(TRUE);
|
|
|
+ currentNodeFunc->SetHasSuperReference(TRUE);
|
|
|
CHAKRATEL_LANGSTATS_INC_LANGFEATURECOUNT(ES6, Super, m_scriptContext);
|
|
|
|
|
|
// If we are defer parsing, we can skip verifying that the super reference is valid.
|
|
|
@@ -12793,7 +12755,7 @@ ParseNodePtr Parser::ParseDestructuredVarDecl(tokens declarationType, bool isDec
|
|
|
{
|
|
|
if (IsStrictMode() && pnodeElem != nullptr && pnodeElem->nop == knopName)
|
|
|
{
|
|
|
- CheckStrictModeEvalArgumentsUsage(pnodeElem->AsParseNodePid()->pid);
|
|
|
+ CheckStrictModeEvalArgumentsUsage(pnodeElem->AsParseNodeName()->pid);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
@@ -13080,8 +13042,8 @@ void PrintPnodeWIndent(ParseNode *pnode, int indentAmt) {
|
|
|
//PTNODE(knopName , "name" ,None ,Pid ,fnopLeaf)
|
|
|
case knopName:
|
|
|
Indent(indentAmt);
|
|
|
- if (pnode->AsParseNodePid()->pid != NULL) {
|
|
|
- Output::Print(_u("id: %s\n"), pnode->AsParseNodePid()->pid->Psz());
|
|
|
+ if (pnode->AsParseNodeName()->pid != NULL) {
|
|
|
+ Output::Print(_u("id: %s\n"), pnode->AsParseNodeName()->pid->Psz());
|
|
|
}
|
|
|
else {
|
|
|
Output::Print(_u("name node\n"));
|
|
|
@@ -13100,7 +13062,7 @@ void PrintPnodeWIndent(ParseNode *pnode, int indentAmt) {
|
|
|
//PTNODE(knopStr , "str const" ,None ,Pid ,fnopLeaf|fnopConst)
|
|
|
case knopStr:
|
|
|
Indent(indentAmt);
|
|
|
- Output::Print(_u("\"%s\"\n"), pnode->AsParseNodePid()->pid->Psz());
|
|
|
+ Output::Print(_u("\"%s\"\n"), pnode->AsParseNodeStr()->pid->Psz());
|
|
|
break;
|
|
|
//PTNODE(knopRegExp , "reg expr" ,None ,Pid ,fnopLeaf|fnopConst)
|
|
|
case knopRegExp:
|
|
|
@@ -13732,7 +13694,7 @@ void PrintPnodeWIndent(ParseNode *pnode, int indentAmt) {
|
|
|
Indent(indentAmt);
|
|
|
Output::Print(_u("catch (%d-%d)\n"), pnode->ichMin, pnode->ichLim);
|
|
|
PrintScopesWIndent(pnode, indentAmt + INDENT_SIZE);
|
|
|
- PrintPnodeWIndent(pnode->AsParseNodeCatch()->pnodeParam, indentAmt + INDENT_SIZE);
|
|
|
+ PrintPnodeWIndent(pnode->AsParseNodeCatch()->GetParam(), indentAmt + INDENT_SIZE);
|
|
|
// if (pnode->AsParseNodeCatch()->pnodeGuard!=NULL)
|
|
|
// PrintPnodeWIndent(pnode->AsParseNodeCatch()->pnodeGuard,indentAmt+INDENT_SIZE);
|
|
|
PrintPnodeWIndent(pnode->AsParseNodeCatch()->pnodeBody, indentAmt + INDENT_SIZE);
|