| 3980 | } |
| 3981 | |
| 3982 | void BfAutoComplete::FixitAddMethod(BfTypeInstance* typeInst, const StringImpl& methodName, BfType* returnType, const BfTypeVector& paramTypes, bool wantStatic) |
| 3983 | { |
| 3984 | if ((typeInst->IsEnum()) && (returnType == typeInst) && (wantStatic)) |
| 3985 | { |
| 3986 | FixitAddCase(typeInst, methodName, paramTypes); |
| 3987 | return; |
| 3988 | } |
| 3989 | |
| 3990 | if ((typeInst->mTypeDef->mSource != NULL) && (typeInst != mModule->mContext->mBfObjectType)) |
| 3991 | { |
| 3992 | auto parser = typeInst->mTypeDef->GetDefinition()->mSource->ToParser(); |
| 3993 | if (parser != NULL) |
| 3994 | { |
| 3995 | String fullName = typeInst->mTypeDef->mFullName.ToString(); |
| 3996 | String methodStr; |
| 3997 | |
| 3998 | methodStr += "\f\a"; |
| 3999 | |
| 4000 | if (typeInst == mModule->mCurTypeInstance) |
| 4001 | { |
| 4002 | // Implicitly private |
| 4003 | } |
| 4004 | else if (mModule->TypeIsSubTypeOf(mModule->mCurTypeInstance, typeInst)) |
| 4005 | { |
| 4006 | methodStr += "protected "; |
| 4007 | } |
| 4008 | else |
| 4009 | { |
| 4010 | methodStr += "public "; |
| 4011 | } |
| 4012 | |
| 4013 | if (wantStatic) |
| 4014 | methodStr += "static "; |
| 4015 | |
| 4016 | if (returnType != NULL) |
| 4017 | methodStr += mModule->TypeToString(returnType, BfTypeNameFlag_ReduceName); |
| 4018 | else |
| 4019 | methodStr += "void"; |
| 4020 | |
| 4021 | methodStr += " " + methodName + "("; |
| 4022 | |
| 4023 | FixitGetParamString(paramTypes, methodStr); |
| 4024 | |
| 4025 | int insertPos = FixitGetMemberInsertPos(typeInst->mTypeDef); |
| 4026 | |
| 4027 | methodStr += ")"; |
| 4028 | methodStr += "\t"; |
| 4029 | AddEntry(AutoCompleteEntry("fixit", StrFormat("Create method '%s' in '%s'\taddMethod|%s|%s", methodName.c_str(), fullName.c_str(), FixitGetLocation(parser->mParserData, insertPos).c_str(), methodStr.c_str()).c_str())); |
| 4030 | } |
| 4031 | } |
| 4032 | } |
| 4033 | |
| 4034 | void BfAutoComplete::FixitAddNamespace(BfAstNode* refNode, const StringImpl& namespaceStr) |
| 4035 | { |
no test coverage detected