@@ -56,10 +56,10 @@ struct StmtNest
5656 };
5757 StmtNest *pstmtOuter; // Enclosing statement.
5858
59- OpCode GetNop () const
60- {
59+ OpCode GetNop () const
60+ {
6161 AnalysisAssert (isDeferred || pnodeStmt != nullptr );
62- return isDeferred ? op : pnodeStmt->nop ;
62+ return isDeferred ? op : pnodeStmt->nop ;
6363 }
6464};
6565
@@ -78,63 +78,85 @@ Parser::Parser(Js::ScriptContext* scriptContext, BOOL strictMode, PageAllocator
7878Parser::Parser (Js::ScriptContext* scriptContext, BOOL strictMode, PageAllocator *alloc, bool isBackground)
7979#endif
8080 : m_nodeAllocator(_u(" Parser" ), alloc ? alloc : scriptContext->GetThreadContext ()->GetPageAllocator(), Parser::OutOfMemory),
81+ m_cactIdentToNodeLookup(0 ),
82+ m_grfscr(fscrNil),
83+ m_length(0 ),
84+ m_originalLength(0 ),
85+ m_nextFunctionId(nullptr ),
86+ m_sourceContextInfo(nullptr ),
87+ #if ENABLE_BACKGROUND_PARSING
88+ m_isInBackground (isBackground),
89+ m_hasParallelJob(false ),
90+ m_doingFastScan(false ),
91+ #endif
92+ m_nextBlockId (0 ),
8193 // use the GuestArena directly for keeping the RegexPattern* alive during byte code generation
82- m_registeredRegexPatterns(scriptContext->GetGuestArena ())
94+ m_registeredRegexPatterns(scriptContext->GetGuestArena ()),
95+
96+ m_scriptContext(scriptContext),
97+ m_phtbl(nullptr ),
98+
99+ m_token(), // should initialize to 0/nullptrs
100+ m_pscan(nullptr ),
101+
102+ m_currentNodeNonLambdaFunc(nullptr ),
103+ m_currentNodeNonLambdaDeferredFunc(nullptr ),
104+ m_currentNodeFunc(nullptr ),
105+ m_currentNodeDeferredFunc(nullptr ),
106+ m_currentNodeProg(nullptr ),
107+ m_currDeferredStub(nullptr ),
108+ m_prevSiblingDeferredStub(nullptr ),
109+ m_pCurrentAstSize(nullptr ),
110+ m_ppnodeScope(nullptr ),
111+ m_ppnodeExprScope(nullptr ),
112+ m_ppnodeVar(nullptr ),
113+ m_inDeferredNestedFunc(false ),
114+ m_reparsingLambdaParams(false ),
115+ m_disallowImportExportStmt(false ),
116+ m_isInParsingArgList(false ),
117+ m_hasDestructuringPattern(false ),
118+ m_hasDeferredShorthandInitError(false ),
119+ m_pnestedCount(nullptr ),
120+
121+ wellKnownPropertyPids(), // should initialize to nullptrs
122+ m_sourceLim(0 ),
123+ m_functionBody(nullptr ),
124+ m_parseType(ParseType_Upfront),
125+
126+ m_arrayDepth(0 ),
127+ m_funcInArrayDepth(0 ),
128+ m_funcInArray(0 ),
129+ m_scopeCountNoAst(0 ),
130+
131+ m_parsingSuperRestrictionState(ParsingSuperRestrictionState_SuperDisallowed),
132+
133+ m_funcParenExprDepth(0 ),
134+ m_deferEllipsisError(false ),
135+ m_deferEllipsisErrorLoc(), // calls default initializer
136+
137+ m_tryCatchOrFinallyDepth(0 ),
138+
139+ m_pstmtCur(nullptr ),
140+ m_currentBlockInfo(nullptr ),
141+ m_currentScope(nullptr ),
142+
143+ currBackgroundParseItem(nullptr ),
144+ backgroundParseItems(nullptr ),
145+ fastScannedRegExpNodes(nullptr ),
146+
147+ m_currentDynamicBlock(nullptr ),
148+
149+ m_UsesArgumentsAtGlobal(false ),
150+
151+ m_fUseStrictMode(strictMode),
152+ m_InAsmMode(false ),
153+ m_deferAsmJs(true ),
154+ m_fExpectExternalSource(FALSE ),
155+ m_deferringAST(FALSE ),
156+ m_stoppedDeferredParse(FALSE )
83157{
84158 AssertMsg (size == sizeof (Parser), " verify conditionals affecting the size of Parser agree" );
85159 Assert (scriptContext != nullptr );
86- m_phtbl = nullptr ;
87- m_pscan = nullptr ;
88- m_deferringAST = FALSE ;
89- m_stoppedDeferredParse = FALSE ;
90- #if ENABLE_BACKGROUND_PARSING
91- m_isInBackground = isBackground;
92- m_hasParallelJob = false ;
93- m_doingFastScan = false ;
94- #endif
95- m_isInParsingArgList = false ;
96- m_hasDestructuringPattern = false ;
97- m_scriptContext = scriptContext;
98- m_pCurrentAstSize = nullptr ;
99- m_arrayDepth = 0 ;
100- m_funcInArrayDepth = 0 ;
101- m_funcParenExprDepth = 0 ;
102- m_funcInArray = 0 ;
103- m_tryCatchOrFinallyDepth = 0 ;
104- m_UsesArgumentsAtGlobal = false ;
105- m_currentNodeFunc = nullptr ;
106- m_currentNodeDeferredFunc = nullptr ;
107- m_currentNodeNonLambdaFunc = nullptr ;
108- m_currentNodeNonLambdaDeferredFunc = nullptr ;
109- m_currentNodeProg = nullptr ;
110- m_currDeferredStub = nullptr ;
111- m_prevSiblingDeferredStub = nullptr ;
112- m_pstmtCur = nullptr ;
113- m_currentBlockInfo = nullptr ;
114- m_currentScope = nullptr ;
115- m_currentDynamicBlock = nullptr ;
116- m_grfscr = fscrNil;
117- m_length = 0 ;
118- m_originalLength = 0 ;
119- m_nextFunctionId = nullptr ;
120- m_reparsingLambdaParams = false ;
121- currBackgroundParseItem = nullptr ;
122- backgroundParseItems = nullptr ;
123- fastScannedRegExpNodes = nullptr ;
124-
125- m_fUseStrictMode = strictMode;
126- m_InAsmMode = false ;
127- m_deferAsmJs = true ;
128- m_scopeCountNoAst = 0 ;
129- m_fExpectExternalSource = 0 ;
130-
131- m_parseType = ParseType_Upfront;
132-
133- m_deferEllipsisError = false ;
134- m_hasDeferredShorthandInitError = false ;
135- m_parsingSuperRestrictionState = ParsingSuperRestrictionState_SuperDisallowed;
136-
137- m_disallowImportExportStmt = false ;
138160}
139161
140162Parser::~Parser (void )
@@ -5429,7 +5451,7 @@ bool Parser::ParseFncDeclHelper(ParseNodePtr pnodeFnc, LPCOLESTR pNameHint, usho
54295451 }
54305452
54315453 // These are heuristic conditions that prohibit upfront deferral but not redeferral.
5432- isTopLevelDeferredFunc = isTopLevelDeferredFunc && !isDeferredFnc &&
5454+ isTopLevelDeferredFunc = isTopLevelDeferredFunc && !isDeferredFnc &&
54335455 (!isLikelyIIFE || !topLevelStmt || PHASE_FORCE_RAW (Js::DeferParsePhase, m_sourceContextInfo->sourceContextId , pnodeFnc->sxFnc .functionId ));
54345456
54355457#if ENABLE_BACKGROUND_PARSING
@@ -6559,7 +6581,7 @@ bool Parser::ParseFncNames(ParseNodePtr pnodeFnc, ParseNodePtr pnodeFncParent, u
65596581 {
65606582 // Multiple names. Turn the source into an IdentPtr.
65616583 pnodeFnc->sxFnc .pid = m_phtbl->PidHashNameLen (
6562- m_pscan->PchBase () + ichMinNames,
6584+ m_pscan->PchBase () + ichMinNames,
65636585 m_pscan->AdjustedLast (),
65646586 ichLimNames - ichMinNames);
65656587 }
@@ -7249,7 +7271,7 @@ void Parser::FinishFncNode(ParseNodePtr pnodeFnc)
72497271 else
72507272 {
72517273 m_pscan->SetCurrentCharacter (pnodeFnc->ichMin , pnodeFnc->sxFnc .lineNumber );
7252-
7274+
72537275 if (fMethod )
72547276 {
72557277 // Method. Skip identifier name, computed property name, "async", "get", "set", and '*' or '(' characters.
@@ -8866,7 +8888,7 @@ ParseNodePtr Parser::ParseExpr(int oplMin,
88668888
88678889 ParseDestructuredLiteralWithScopeSave (tkLCurly, false /* isDecl*/ , false /* topLevel*/ , DIC_ShouldNotParseInitializer);
88688890
8869- // Restore the Block ID at the end of the reparsing so it matches the one at the end of the first pass. We need to do this
8891+ // Restore the Block ID at the end of the reparsing so it matches the one at the end of the first pass. We need to do this
88708892 // because we don't parse initializers during reparse and there may be additional blocks (e.g. a class declaration)
88718893 // in the initializers that will cause the next Block ID at the end of the reparsing to be different.
88728894 m_nextBlockId = saveNextBlockId;
@@ -8976,9 +8998,9 @@ ParseNodePtr Parser::ParseExpr(int oplMin,
89768998 }
89778999
89789000 // Assignment stmt of the form "this.<id> = <expr>"
8979- if (nop == knopAsg
8980- && pnode->nop == knopDot
8981- && pnode->sxBin .pnode1 ->nop == knopName
9001+ if (nop == knopAsg
9002+ && pnode->nop == knopDot
9003+ && pnode->sxBin .pnode1 ->nop == knopName
89829004 && pnode->sxBin .pnode1 ->sxVar .pid == wellKnownPropertyPids._this
89839005 && pnode->sxBin .pnode2 ->nop == knopName)
89849006 {
@@ -12761,7 +12783,7 @@ IdentPtr Parser::ParseSuper(bool fAllowCall)
1276112783 // Anything else is an error
1276212784 Error (ERRInvalidSuper);
1276312785 }
12764-
12786+
1276512787 return superPid;
1276612788}
1276712789
0 commit comments