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

Method FixitGetParamString

IDEHelper/Compiler/BfAutoComplete.cpp:3818–3897  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3816}
3817
3818void BfAutoComplete::FixitGetParamString(const BfTypeVector& paramTypes, StringImpl& outStr)
3819{
3820 std::set<String> usedNames;
3821
3822 for (int argIdx = 0; argIdx < (int)paramTypes.size(); argIdx++)
3823 {
3824 if (argIdx > 0)
3825 outStr += ", ";
3826 BfType* paramType = paramTypes[argIdx];
3827 String checkName = "param";
3828 if (paramType != NULL)
3829 {
3830 bool isOut = false;
3831 bool isArr = false;
3832
3833 BfType* checkType = paramType;
3834 while (true)
3835 {
3836 if ((checkType->IsArray()) || (checkType->IsSizedArray()))
3837 {
3838 isArr = true;
3839 checkType = checkType->GetUnderlyingType();
3840 }
3841 else if (checkType->IsRef())
3842 {
3843 BfRefType* refType = (BfRefType*)checkType;
3844 if (refType->mRefKind == BfRefType::RefKind_Out)
3845 isOut = true;
3846 checkType = refType->GetUnderlyingType();
3847 }
3848 else if (checkType->IsTypeInstance())
3849 {
3850 BfTypeInstance* typeInst = (BfTypeInstance*)checkType;
3851 checkName = typeInst->mTypeDef->mName->ToString();
3852 if (checkName == "String")
3853 checkName = "Str";
3854 if (checkName == "Object")
3855 checkName = "Obj";
3856 if (isOut)
3857 checkName = "out" + checkName;
3858 else if (isupper(checkName[0]))
3859 {
3860 checkName[0] = tolower(checkName[0]);
3861 for (int i = 1; i < (int)checkName.length(); i++)
3862 {
3863 if ((i + 1 < (int)checkName.length()) &&
3864 (islower(checkName[i + 1])))
3865 break;
3866 checkName[i] = tolower(checkName[i]);
3867 }
3868 }
3869 if (isArr)
3870 checkName += "Arr";
3871 break;
3872 }
3873 else
3874 break;
3875 }

Callers

nothing calls this directly

Calls 9

sizeMethod · 0.45
IsArrayMethod · 0.45
IsSizedArrayMethod · 0.45
GetUnderlyingTypeMethod · 0.45
IsRefMethod · 0.45
IsTypeInstanceMethod · 0.45
ToStringMethod · 0.45
lengthMethod · 0.45
TypeToStringMethod · 0.45

Tested by

no test coverage detected