| 18737 | } |
| 18738 | |
| 18739 | void 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 | |
| 18770 | void BfModule::EmitCtorBody(bool& skipBody) |
| 18771 | { |
nothing calls this directly
no test coverage detected