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

Method SetupMethodIdHash

IDEHelper/Compiler/BfModule.cpp:15505–15535  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15503}
15504
15505void BfModule::SetupMethodIdHash(BfMethodInstance* methodInstance)
15506{
15507 HashContext hashCtx;
15508
15509 std::function<void(BfMethodInstance*)> _MixinMethodInstance = [&](BfMethodInstance* methodInstance)
15510 {
15511 hashCtx.Mixin(methodInstance->GetOwner()->mTypeId);
15512 hashCtx.Mixin(methodInstance->mMethodDef->mIdx);
15513
15514 if (methodInstance->GetNumGenericArguments() != 0)
15515 {
15516 hashCtx.Mixin((int32)methodInstance->mMethodInfoEx->mMethodGenericArguments.size());
15517 for (auto methodGenericArg : methodInstance->mMethodInfoEx->mMethodGenericArguments)
15518 hashCtx.Mixin(methodGenericArg->mTypeId);
15519 }
15520 };
15521
15522 _MixinMethodInstance(methodInstance);
15523
15524 if (methodInstance->mMethodDef->mIsLocalMethod)
15525 {
15526 auto outmostMethodInstance = mCurMethodState->GetRootMethodState()->mMethodInstance;
15527 if (outmostMethodInstance != NULL)
15528 {
15529 BF_ASSERT((outmostMethodInstance->mIdHash != 0) || (outmostMethodInstance->mIsAutocompleteMethod));
15530 hashCtx.Mixin(outmostMethodInstance->mIdHash);
15531 }
15532 }
15533
15534 methodInstance->mIdHash = (int64)hashCtx.Finish64();
15535}
15536
15537bool BfModule::CheckUseMethodInstance(BfMethodInstance* methodInstance, BfAstNode* refNode)
15538{

Callers

nothing calls this directly

Calls 6

GetRootMethodStateMethod · 0.80
Finish64Method · 0.80
MixinMethod · 0.45
GetOwnerMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected