@@ -5463,8 +5463,15 @@ void Parser::ParseFncDeclHelper(ParseNodeFnc * pnodeFnc, LPCOLESTR pNameHint, us
5463
5463
m_reparsingLambdaParams = true ;
5464
5464
}
5465
5465
5466
+ uint savedStubCount = m_currDeferredStubCount;
5467
+ DeferredFunctionStub* savedStub = m_currDeferredStub;
5468
+ ShiftCurrDeferredStubToChildFunction (pnodeFnc, pnodeFncParent);
5469
+
5466
5470
this ->ParseFncFormals <buildAST>(pnodeFnc, pnodeFncParent, flags, isTopLevelDeferredFunc);
5467
5471
5472
+ m_currDeferredStub = savedStub;
5473
+ m_currDeferredStubCount = savedStubCount;
5474
+
5468
5475
m_reparsingLambdaParams = fLambdaParamsSave ;
5469
5476
}
5470
5477
@@ -5637,13 +5644,10 @@ void Parser::ParseFncDeclHelper(ParseNodeFnc * pnodeFnc, LPCOLESTR pNameHint, us
5637
5644
}
5638
5645
uint savedStubCount = m_currDeferredStubCount;
5639
5646
DeferredFunctionStub* savedStub = m_currDeferredStub;
5640
- if (pnodeFnc->IsNested () && pnodeFncSave != nullptr && m_currDeferredStub != nullptr && pnodeFncSave->ichMin != pnodeFnc->ichMin )
5641
- {
5642
- DeferredFunctionStub* childStub = m_currDeferredStub + (pnodeFncSave->nestedCount - 1 );
5643
- m_currDeferredStubCount = childStub->nestedCount ;
5644
- m_currDeferredStub = childStub->deferredStubs ;
5645
- }
5647
+ ShiftCurrDeferredStubToChildFunction (pnodeFnc, pnodeFncSave);
5648
+
5646
5649
this ->FinishFncDecl (pnodeFnc, pNameHint, fLambda , skipFormals, fAllowIn );
5650
+
5647
5651
m_currDeferredStub = savedStub;
5648
5652
m_currDeferredStubCount = savedStubCount;
5649
5653
}
@@ -14021,6 +14025,23 @@ bool Parser::IsCreatingStateCache()
14021
14025
&& CONFIG_FLAG (ParserStateCache));
14022
14026
}
14023
14027
14028
+ void Parser::ShiftCurrDeferredStubToChildFunction (ParseNodeFnc* pnodeFnc, ParseNodeFnc* pnodeFncParent)
14029
+ {
14030
+ // Goal here is to shift the current deferred stub to point to the stubs for pnodeFnc
14031
+ // so we may continue parsing pnodeFnc using the correct set of stubs instead of the
14032
+ // stubs for pnodeFncParent.
14033
+ // This function assumes we are in the middle of parsing pnodeFnc which is a child
14034
+ // nested in pnodeFncParent.
14035
+ if (pnodeFnc->IsNested () && pnodeFncParent != nullptr && m_currDeferredStub != nullptr && pnodeFncParent->ichMin != pnodeFnc->ichMin )
14036
+ {
14037
+ AssertOrFailFast (pnodeFncParent->nestedCount > 0 );
14038
+
14039
+ DeferredFunctionStub* childStub = m_currDeferredStub + (pnodeFncParent->nestedCount - 1 );
14040
+ m_currDeferredStubCount = childStub->nestedCount ;
14041
+ m_currDeferredStub = childStub->deferredStubs ;
14042
+ }
14043
+ }
14044
+
14024
14045
uint Parser::BuildDeferredStubTreeHelper (ParseNodeBlock* pnodeBlock, DeferredFunctionStub* deferredStubs, uint currentStubIndex, uint deferredStubCount, Recycler *recycler)
14025
14046
{
14026
14047
Assert (pnodeBlock != nullptr
0 commit comments