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

Method UpdateRevisedTypes

IDEHelper/Compiler/BfContext.cpp:2160–2767  ·  view source on GitHub ↗

Note that this method can also cause modules to be build in other contexts. That's why we do our UpdateAfterDeletingTypes after all the contexts' UpdateRevisedTypes

Source from the content-addressed store, hash-verified

2158// Note that this method can also cause modules to be build in other contexts.
2159// That's why we do our UpdateAfterDeletingTypes after all the contexts' UpdateRevisedTypes
2160void BfContext::UpdateRevisedTypes()
2161{
2162 BP_ZONE("BfContext::UpdateRevisedTypes");
2163 BfLogSysM("BfContext::UpdateRevisedTypes\n");
2164
2165 auto _CheckCanSkipCtor = [&](BfTypeDef* typeDef)
2166 {
2167 if (typeDef == NULL)
2168 return true;
2169 typeDef = typeDef->GetLatest();
2170
2171 for (auto fieldDef : typeDef->mFields)
2172 {
2173 if (fieldDef->mIsStatic)
2174 continue;
2175 if (fieldDef->GetInitializer() != NULL)
2176 return false;
2177 }
2178
2179 for (auto methodDef : typeDef->mMethods)
2180 {
2181 if (methodDef->mMethodType == BfMethodType_Init)
2182 return false;
2183 }
2184
2185 return true;
2186 };
2187
2188 auto _CheckCanSkipCtorByName = [&](const StringImpl& name)
2189 {
2190 BfAtomComposite qualifiedFindName;
2191 if (!mSystem->ParseAtomComposite(name, qualifiedFindName))
2192 return true;
2193 auto itr = mSystem->mTypeDefs.TryGet(qualifiedFindName);
2194 while (itr)
2195 {
2196 BfTypeDef* typeDef = *itr;
2197 if ((typeDef->mDefState != BfTypeDef::DefState_Deleted) &&
2198 (!typeDef->mIsCombinedPartial))
2199 {
2200 if (typeDef->mFullNameEx == qualifiedFindName)
2201 if (!_CheckCanSkipCtor(typeDef))
2202 return false;
2203 }
2204 itr.MoveToNextHashMatch();
2205 }
2206
2207 return true;
2208 };
2209
2210 bool wantsCanSkipObjectCtor = _CheckCanSkipCtorByName("System.Object");
2211 bool wantsCanSkipValueTypeCtor = _CheckCanSkipCtorByName("System.ValueType");
2212
2213 int wantPtrSize;
2214 if ((mCompiler->mOptions.mMachineType == BfMachineType_x86) |
2215 (mCompiler->mOptions.mMachineType == BfMachineType_ARM) ||
2216 (mCompiler->mOptions.mMachineType == BfMachineType_Wasm32))
2217 wantPtrSize = 4;

Callers

nothing calls this directly

Calls 15

GetLatestMethod · 0.80
GetInitializerMethod · 0.80
ParseAtomCompositeMethod · 0.80
IsDeletingMethod · 0.80
GetTypeDeclListHashMethod · 0.80
GetLatestVersionMethod · 0.80
HasSourceMethod · 0.80
MixinStrMethod · 0.80
Finish128Method · 0.80
StartNewRevisionMethod · 0.80
TryGetMethod · 0.45

Tested by

no test coverage detected