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

Method MethodToString

IDEHelper/Compiler/BfModule.cpp:11810–12067  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

11808}
11809
11810StringT<128> BfModule::MethodToString(BfMethodInstance* methodInst, BfMethodNameFlags methodNameFlags, BfTypeVector* typeGenericArgs, BfTypeVector* methodGenericArgs)
11811{
11812 auto methodDef = methodInst->mMethodDef;
11813 bool allowResolveGenericParamNames = ((methodNameFlags & BfMethodNameFlag_ResolveGenericParamNames) != 0);
11814
11815 BfTypeNameFlags typeNameFlags = BfTypeNameFlags_None;
11816
11817 bool hasGenericArgs = (typeGenericArgs != NULL) || (methodGenericArgs != NULL);
11818
11819 BfType* type = methodInst->mMethodInstanceGroup->mOwner;
11820 if ((hasGenericArgs) && (type->IsUnspecializedType()))
11821 type = ResolveGenericType(type, typeGenericArgs, methodGenericArgs, mCurTypeInstance);
11822 if ((type == NULL) || (!type->IsUnspecializedTypeVariation()))
11823 typeNameFlags = BfTypeNameFlag_ResolveGenericParamNames;
11824 if (allowResolveGenericParamNames)
11825 typeNameFlags = BfTypeNameFlag_ResolveGenericParamNames;
11826
11827 StringT<128> methodName;
11828
11829 auto _AddTypeName = [&](BfType* type)
11830 {
11831 auto typeNameFlags = BfTypeNameFlags_None;
11832 if (allowResolveGenericParamNames)
11833 typeNameFlags = BfTypeNameFlag_ResolveGenericParamNames;
11834 if ((hasGenericArgs) && (type->IsUnspecializedType()))
11835 type = ResolveGenericType(type, typeGenericArgs, methodGenericArgs, mCurTypeInstance);
11836 methodName += TypeToString(type, typeNameFlags);
11837 };
11838
11839 if ((methodNameFlags & BfMethodNameFlag_IncludeReturnType) != 0)
11840 {
11841 _AddTypeName(methodInst->mReturnType);
11842 methodName += " ";
11843 }
11844
11845 if ((methodNameFlags & BfMethodNameFlag_OmitTypeName) == 0)
11846 {
11847 methodName += TypeToString(type, typeNameFlags);
11848 if (methodName == "$")
11849 methodName = "";
11850 else if (!methodName.IsEmpty())
11851 methodName += ".";
11852 }
11853 String accessorString;
11854 StringT<64> methodDefName = methodInst->mMethodDef->mName;
11855
11856 if (methodInst->mMethodDef->mIsLocalMethod)
11857 {
11858 int atPos = (int)methodDefName.IndexOf('$');
11859 methodDefName.RemoveToEnd(atPos);
11860 methodDefName.Replace("@", ".");
11861 }
11862 else
11863 {
11864 int atPos = (int)methodDefName.IndexOf('$');
11865 if (atPos != -1)
11866 {
11867 accessorString = methodDefName.Substring(0, atPos);

Callers 15

FinishMethod · 0.80
AddMethodMethod · 0.80
GetTestMethodsMethod · 0.80
ToStringMethod · 0.80
PrintMethod · 0.80
NextMethod · 0.80
FailMethod · 0.80
CallMethod · 0.80
ExecuteMethod · 0.80
FailCurrentMethod · 0.80
MangleMethod · 0.80
FlushAmbiguityErrorMethod · 0.80

Calls 15

TypeToStringFunction · 0.85
SubstringMethod · 0.80
GetTokenMethod · 0.80
GetParamKindMethod · 0.80
GetParamInitializerMethod · 0.80
IsUnspecializedTypeMethod · 0.45
IsEmptyMethod · 0.45
IndexOfMethod · 0.45
RemoveToEndMethod · 0.45
ReplaceMethod · 0.45

Tested by

no test coverage detected