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

Method EmitInitBlocks

IDEHelper/Compiler/BfModule.cpp:18739–18768  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18737}
18738
18739void BfModule::EmitInitBlocks(const std::function<void(BfAstNode*)>& initBlockCallback)
18740{
18741 auto methodDef = mCurMethodInstance->mMethodDef;
18742
18743 mCurTypeInstance->mTypeDef->PopulateMemberSets();
18744 BfMemberSetEntry* entry = NULL;
18745 BfMethodDef* initMethodDef = NULL;
18746 mCurTypeInstance->mTypeDef->mMethodSet.TryGetWith(String("__BfInit"), &entry);
18747 if (entry != NULL)
18748 initMethodDef = (BfMethodDef*)entry->mMemberDef;
18749
18750 SizedArray<BfAstNode*, 8> initBodies;
18751
18752 for (; initMethodDef != NULL; initMethodDef = initMethodDef->mNextWithSameName)
18753 {
18754 if (initMethodDef->mDeclaringType->GetDefinition() != methodDef->mDeclaringType->GetDefinition())
18755 continue;
18756 if (initMethodDef->mMethodType != BfMethodType_Init)
18757 continue;
18758 if (initMethodDef->mIsStatic != methodDef->mIsStatic)
18759 continue;
18760 initBodies.Insert(0, initMethodDef->mBody);
18761 }
18762
18763 for (auto body : initBodies)
18764 {
18765 initBlockCallback(body);
18766 VisitEmbeddedStatement(body);
18767 }
18768}
18769
18770void BfModule::EmitCtorBody(bool& skipBody)
18771{

Callers

nothing calls this directly

Calls 5

StringClass · 0.85
PopulateMemberSetsMethod · 0.80
TryGetWithMethod · 0.80
GetDefinitionMethod · 0.80
InsertMethod · 0.45

Tested by

no test coverage detected