MCPcopy Create free account
hub / github.com/beefytech/Beef / EmitDeferredScopeCalls

Method EmitDeferredScopeCalls

IDEHelper/Compiler/BfModule.cpp:16769–17059  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

16767}
16768
16769void BfModule::EmitDeferredScopeCalls(bool useSrcPositions, BfScopeData* scopeData, BfIRBlock doneBlock)
16770{
16771 // Is there anything we need to do here?
16772 if (mBfIRBuilder->mIgnoreWrites)
16773 {
16774 // Just visit deferred blocks
16775 BfScopeData* checkScope = mCurMethodState->mCurScope;
16776 while (checkScope != NULL)
16777 {
16778 BfDeferredCallEntry* deferredCallEntry = checkScope->mDeferredCallEntries.mHead;
16779 while (deferredCallEntry != NULL)
16780 {
16781 if (deferredCallEntry->mDeferredBlock != NULL)
16782 {
16783 SetAndRestoreValue<BfMixinState*> prevMixinState(mCurMethodState->mMixinState, checkScope->mMixinState);
16784
16785 if (checkScope == &mCurMethodState->mHeadScope)
16786 CreateRetValLocal();
16787
16788 SetAndRestoreValue<BfAstNode*> prevCustomAttribute(mCurMethodState->mEmitRefNode, deferredCallEntry->mEmitRefNode);
16789 VisitEmbeddedStatement(deferredCallEntry->mDeferredBlock, NULL, BfEmbeddedStatementFlags_IsDeferredBlock);
16790 }
16791 deferredCallEntry = deferredCallEntry->mNext;
16792 }
16793
16794 if (checkScope == scopeData)
16795 break;
16796 checkScope = checkScope->mPrevScope;
16797 }
16798
16799 return;
16800 }
16801
16802 // Why did we want to do SetIllegalSrcPos here?
16803 // Don't we always want to step onto these instances?
16804 // Find a case where we don't and perhaps only do it there.
16805 // The downside was that 'EmitEnsureInstructionAt' on the end of block statements causes
16806 // a (seemingly) unneeded NOP when we do SetIllegalSrcPos
16807 //SetIllegalSrcPos();
16808
16809 bool setSrcPos = false;
16810
16811 bool wantsNop = true;
16812
16813 BfAstNode* deferCloseNode = NULL;
16814
16815 if (mCurMethodState->mInPostReturn)
16816 {
16817 // These won't get used, they are post-return
16818 return;
16819 }
16820
16821 SizedArray<BfIRValue, 8> deferredLifetimeEnds;
16822
16823 BfScopeData* scopeJumpBlock = NULL;
16824
16825 bool hadExtraDeferredLifetimeEnds = false;
16826

Callers

nothing calls this directly

Calls 15

CreateLifetimeEndMethod · 0.80
SaveDebugLocationMethod · 0.80
ClearDebugLocationMethod · 0.80
MaybeChainNewBlockMethod · 0.80
RestoreDebugLocationMethod · 0.80
CreateStackRestoreMethod · 0.80
CreateAddMethod · 0.80
clearMethod · 0.45
CreateBrMethod · 0.45
IsEmptyMethod · 0.45
CreateBlockMethod · 0.45

Tested by

no test coverage detected