1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

MethodToString improvements

This commit is contained in:
Brian Fiete 2020-10-08 10:17:03 -07:00
parent b28a87136f
commit 3fb7576bf9
2 changed files with 30 additions and 8 deletions

View file

@ -471,6 +471,12 @@ void BfAutoComplete::AddMethod(BfTypeInstance* typeInstance, BfMethodDef* method
{ {
if (methodDecl != NULL) if (methodDecl != NULL)
{ {
if ((methodInstance != NULL) && (methodInstance->mMethodDef->mIsLocalMethod) && (GetCursorIdx(methodDecl) == methodDecl->mReturnType->mSrcEnd))
{
// This isn't really a local method decl, it just looks like one
return;
}
if (CheckDocumentation(entryAdded, NULL)) if (CheckDocumentation(entryAdded, NULL))
{ {
String str; String str;
@ -479,7 +485,12 @@ void BfAutoComplete::AddMethod(BfTypeInstance* typeInstance, BfMethodDef* method
if (methodInstance != NULL) if (methodInstance != NULL)
str = mModule->MethodToString(methodInstance, BfMethodNameFlag_IncludeReturnType); str = mModule->MethodToString(methodInstance, BfMethodNameFlag_IncludeReturnType);
if (methodDecl->mDocumentation != NULL) if (entryAdded->mDocumentation != NULL)
{
str += "\x04";
str.Append(entryAdded->mDocumentation);
}
else if (methodDecl->mDocumentation != NULL)
{ {
if (!str.IsEmpty()) if (!str.IsEmpty())
str += "\x04"; str += "\x04";
@ -668,6 +679,8 @@ void BfAutoComplete::AddProp(BfTypeInstance* typeInst, BfPropertyDef* propDef, c
if (CheckDocumentation(entryAdded, documentation)) if (CheckDocumentation(entryAdded, documentation))
{ {
BfType* propType = NULL; BfType* propType = NULL;
bool hasGetter = false;
bool hasSetter = false;
for (auto methodDef : propDef->mMethods) for (auto methodDef : propDef->mMethods)
{ {
@ -676,16 +689,14 @@ void BfAutoComplete::AddProp(BfTypeInstance* typeInst, BfPropertyDef* propDef, c
continue; continue;
if (methodDef->mMethodType == BfMethodType_PropertyGetter) if (methodDef->mMethodType == BfMethodType_PropertyGetter)
{ {
propType = methodInstance->mReturnType; hasGetter = true;
break; propType = methodInstance->mReturnType;
} }
if (methodDef->mMethodType == BfMethodType_PropertySetter) if (methodDef->mMethodType == BfMethodType_PropertySetter)
{ {
if (methodInstance->GetParamCount() > 0) hasSetter = true;
{ if (methodInstance->GetParamCount() > 0)
propType = methodInstance->GetParamType(0); propType = methodInstance->GetParamType(0);
break;
}
} }
} }
@ -699,6 +710,14 @@ void BfAutoComplete::AddProp(BfTypeInstance* typeInst, BfPropertyDef* propDef, c
str += mModule->TypeToString(typeInst); str += mModule->TypeToString(typeInst);
str += "."; str += ".";
str += propDef->mName; str += propDef->mName;
str += " { ";
if (hasGetter)
str += "get; ";
if (hasSetter)
str += "set; ";
str += "}";
if (documentation != NULL) if (documentation != NULL)
{ {
str += "\x04"; str += "\x04";

View file

@ -9977,6 +9977,9 @@ StringT<128> BfModule::MethodToString(BfMethodInstance* methodInst, BfMethodName
else else
methodName += methodDefName; methodName += methodDefName;
if (methodDef->mMethodType == BfMethodType_Mixin)
methodName += "!";
BfTypeVector newMethodGenericArgs; BfTypeVector newMethodGenericArgs;
if ((methodInst->mMethodInfoEx != NULL) && (methodInst->mMethodInfoEx->mMethodGenericArguments.size() != 0)) if ((methodInst->mMethodInfoEx != NULL) && (methodInst->mMethodInfoEx->mMethodGenericArguments.size() != 0))
{ {