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

Method GetLocalMethodName

IDEHelper/Compiler/BfModule.cpp:23199–23269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23197}
23198
23199String BfModule::GetLocalMethodName(const StringImpl& baseName, BfAstNode* anchorNode, BfMethodState* declMethodState, BfMixinState* declMixinState)
23200{
23201 String name;
23202
23203 bool found = false;
23204 auto checkMethodState = mCurMethodState;
23205 while (checkMethodState != NULL)
23206 {
23207 if (checkMethodState->mClosureState == NULL)
23208 break;
23209 if (checkMethodState->mClosureState->mClosureMethodDef != NULL)
23210 {
23211 found = true;
23212 name += checkMethodState->mClosureState->mClosureMethodDef->mName;
23213 break;
23214 }
23215 checkMethodState = checkMethodState->mPrevMethodState;
23216 }
23217
23218 if (!found)
23219 name += mCurMethodInstance->mMethodDef->mName;
23220
23221 int prevSepPos = (int)name.LastIndexOf('$');
23222 if (prevSepPos != -1)
23223 {
23224 name.RemoveToEnd(prevSepPos);
23225 }
23226
23227 name += "@";
23228 name += baseName;
23229
23230 HashContext hashCtx;
23231 if (anchorNode != NULL)
23232 {
23233 hashCtx.Mixin(anchorNode->GetStartCharId());
23234 }
23235
23236 //
23237 {
23238 auto checkMethodState = declMethodState;
23239 auto checkMixinState = declMixinState;
23240 while (checkMethodState != NULL)
23241 {
23242 if (checkMixinState != NULL)
23243 {
23244 hashCtx.Mixin(checkMixinState->mSource->GetStartCharId());
23245 }
23246 checkMethodState = checkMethodState->mPrevMethodState;
23247 if (checkMethodState != NULL)
23248 checkMixinState = checkMethodState->mMixinState;
23249 }
23250 }
23251
23252 auto rootMethodState = mCurMethodState->GetRootMethodState();
23253 if ((rootMethodState != NULL) && (rootMethodState->mMethodInstance != NULL) && (rootMethodState->mMethodInstance->mMethodInfoEx != NULL))
23254 {
23255 for (auto methodGenericArg : rootMethodState->mMethodInstance->mMethodInfoEx->mMethodGenericArguments)
23256 {

Callers 1

GetLambdaInstanceMethod · 0.80

Calls 9

HashEncode64Function · 0.85
GetStartCharIdMethod · 0.80
GetRootMethodStateMethod · 0.80
GetMangleKindMethod · 0.80
MixinStrMethod · 0.80
Finish64Method · 0.80
LastIndexOfMethod · 0.45
RemoveToEndMethod · 0.45
MixinMethod · 0.45

Tested by

no test coverage detected