| 2488 | } |
| 2489 | |
| 2490 | bool BfAutoComplete::GetMethodInfo(BfMethodInstance* methodInst, StringImpl* showString, StringImpl* insertString, bool isImplementing, bool isExplicitInterface) |
| 2491 | { |
| 2492 | SetAndRestoreValue<BfMethodInstance*> prevMethodInstance(mModule->mCurMethodInstance, methodInst); |
| 2493 | |
| 2494 | auto methodDef = methodInst->mMethodDef; |
| 2495 | bool isInterface = methodInst->GetOwner()->IsInterface(); |
| 2496 | |
| 2497 | BfTypeNameFlags nameFlags = (BfTypeNameFlags)(BfTypeNameFlag_ReduceName | BfTypeNameFlag_ResolveGenericParamNames); |
| 2498 | |
| 2499 | if ((methodDef->mMethodType == BfMethodType_Normal) || (methodDef->mMethodType == BfMethodType_Ctor)) |
| 2500 | { |
| 2501 | StringT<128> methodPrefix; |
| 2502 | StringT<128> methodName; |
| 2503 | StringT<256> impString; |
| 2504 | |
| 2505 | bool isAbstract = (methodDef->mIsAbstract) || (isInterface) || (!methodDef->mIsVirtual); |
| 2506 | |
| 2507 | if (methodDef->mMethodType == BfMethodType_Ctor) |
| 2508 | { |
| 2509 | impString += " : base("; |
| 2510 | isAbstract = false; |
| 2511 | } |
| 2512 | else if (isAbstract) |
| 2513 | { |
| 2514 | if (!methodInst->mReturnType->IsVoid()) |
| 2515 | impString += "return default;"; |
| 2516 | } |
| 2517 | else if (!isAbstract) |
| 2518 | { |
| 2519 | if (!methodInst->mReturnType->IsVoid()) |
| 2520 | impString = "return "; |
| 2521 | |
| 2522 | impString += "base."; |
| 2523 | impString += methodDef->mName; |
| 2524 | impString += "("; |
| 2525 | } |
| 2526 | |
| 2527 | auto methodDeclaration = methodDef->GetMethodDeclaration(); |
| 2528 | |
| 2529 | if (methodDef->HasAppend()) |
| 2530 | methodPrefix += "[AllowAppend]\r"; |
| 2531 | |
| 2532 | if (isInterface) |
| 2533 | { |
| 2534 | if (!isExplicitInterface) |
| 2535 | methodPrefix += "public "; |
| 2536 | } |
| 2537 | else if (methodDeclaration->mProtectionSpecifier != NULL) |
| 2538 | methodPrefix += methodDeclaration->mProtectionSpecifier->ToString() + " "; |
| 2539 | |
| 2540 | if ((!isInterface) && (methodDef->mMethodType != BfMethodType_Ctor)) |
| 2541 | methodPrefix += "override "; |
| 2542 | if (methodDef->mIsStatic) |
| 2543 | methodPrefix += "static "; |
| 2544 | |
| 2545 | if (methodDef->mMethodType != BfMethodType_Ctor) |
| 2546 | { |
| 2547 | methodPrefix += mModule->TypeToString(methodInst->mReturnType, nameFlags); |
nothing calls this directly
no test coverage detected