MCPcopy Create free account
hub / github.com/WheretIB/nullc / ThrowFunctionSelectError

Function ThrowFunctionSelectError

NULLC/Callbacks.cpp:3944–3988  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3942}
3943
3944void ThrowFunctionSelectError(const char* pos, unsigned minRating, char* errorReport, char* errPos, const char* funcName, unsigned callArgCount, unsigned count)
3945{
3946 errPos += SafeSprintf(errPos, NULLC_ERROR_BUFFER_SIZE - int(errPos - errorReport), " %s(", funcName);
3947 for(unsigned int n = 0; n < callArgCount; n++)
3948 {
3949 if(n != 0)
3950 errPos += SafeSprintf(errPos, NULLC_ERROR_BUFFER_SIZE - int(errPos - errorReport), ", ");
3951 NodeZeroOP *activeNode = CodeInfo::nodeList[CodeInfo::nodeList.size()-callArgCount+n];
3952 if(activeNode->nodeType == typeNodeFunctionProxy)
3953 {
3954 int fID = CodeInfo::funcInfo.size(), fCount = 0;
3955 while((fID = CodeInfo::FindFunctionByName(((NodeFunctionProxy*)activeNode)->funcInfo->nameHash, fID - 1)) != -1)
3956 errPos += SafeSprintf(errPos, NULLC_ERROR_BUFFER_SIZE - int(errPos - errorReport), "%s%s", fCount++ != 0 ? " or " : "", CodeInfo::funcInfo[fID]->funcType->GetFullTypeName());
3957 }else if(activeNode->nodeType == typeNodeExpressionList && ((NodeExpressionList*)activeNode)->GetFirstNode()->nodeType == typeNodeFunctionProxy){
3958 errPos += SafeSprintf(errPos, NULLC_ERROR_BUFFER_SIZE - int(errPos - errorReport), "`function`");
3959 }else{
3960 TypeInfo *nodeType = activeNode->nodeType == typeNodeFuncDef ? ((NodeFuncDef*)activeNode)->GetFuncInfo()->funcType : activeNode->typeInfo;
3961 errPos += SafeSprintf(errPos, NULLC_ERROR_BUFFER_SIZE - int(errPos - errorReport), "%s", nodeType->GetFullTypeName());
3962 }
3963 }
3964 errPos += SafeSprintf(errPos, NULLC_ERROR_BUFFER_SIZE - int(errPos - errorReport), minRating == ~0u ? ")\r\n the only available are:\r\n" : ")\r\n candidates are:\r\n");
3965 for(unsigned int n = 0; n < count; n++)
3966 {
3967 if(bestFuncRating[n] != minRating)
3968 continue;
3969 errPos += SafeSprintf(errPos, NULLC_ERROR_BUFFER_SIZE - int(errPos - errorReport), " %s %s(", bestFuncList[n]->retType ? bestFuncList[n]->retType->GetFullTypeName() : "auto", funcName);
3970 for(VariableInfo *curr = bestFuncList[n]->firstParam; curr; curr = curr->next)
3971 errPos += SafeSprintf(errPos, NULLC_ERROR_BUFFER_SIZE - int(errPos - errorReport), "%s%s", curr->varType->GetFullTypeName(), curr != bestFuncList[n]->lastParam ? ", " : "");
3972 if(bestFuncList[n]->generic)
3973 {
3974 if(!bestFuncList[n]->generic->instancedType)
3975 {
3976 errPos += SafeSprintf(errPos, NULLC_ERROR_BUFFER_SIZE - int(errPos - errorReport), ") (wasn't instanced here");
3977 }else{
3978 errPos += SafeSprintf(errPos, NULLC_ERROR_BUFFER_SIZE - int(errPos - errorReport), ") instanced to\r\n %s(", funcName);
3979 FunctionType *tmpType = bestFuncList[n]->generic->instancedType->funcType;
3980 for(unsigned c = 0; c < tmpType->paramCount; c++)
3981 errPos += SafeSprintf(errPos, NULLC_ERROR_BUFFER_SIZE - int(errPos - errorReport), "%s%s", tmpType->paramType[c]->GetFullTypeName(), (c + 1) != tmpType->paramCount ? ", " : "");
3982 }
3983 }
3984 errPos += SafeSprintf(errPos, NULLC_ERROR_BUFFER_SIZE - int(errPos - errorReport), ")\r\n");
3985 }
3986 CodeInfo::lastError = CompilerError(errorReport, pos);
3987 longjmp(CodeInfo::errorHandler, 1);
3988}
3989
3990void RestoreNamespaceStack(NamespaceInfo* info)
3991{

Callers 3

ConvertFunctionToPointerFunction · 0.85
AddMemberFunctionCallFunction · 0.85
AddFunctionCallNodeFunction · 0.85

Calls 6

CompilerErrorClass · 0.85
GetFullTypeNameMethod · 0.80
GetFuncInfoMethod · 0.80
SafeSprintfFunction · 0.70
sizeMethod · 0.45
GetFirstNodeMethod · 0.45

Tested by

no test coverage detected