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

Method FunctionRedirect

NULLC/StdLib.cpp:724–752  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

722}
723
724NULLCFuncPtr NULLC::FunctionRedirect(NULLCRef r, NULLCArray* arr)
725{
726 unsigned int *funcs = (unsigned int*)arr->ptr;
727 NULLCFuncPtr ret = { 0, 0 };
728 if(r.typeID > arr->len)
729 {
730 nullcThrowError("ERROR: type index is out of bounds of redirection table");
731 return ret;
732 }
733 // If there is no implementation for a method
734 if(!funcs[r.typeID])
735 {
736 // Find implemented function ID as a type reference
737 unsigned int found = 0;
738 for(; found < arr->len; found++)
739 {
740 if(funcs[found])
741 break;
742 }
743 if(found == arr->len)
744 nullcThrowError("ERROR: type '%s' doesn't implement method", nullcGetTypeName(r.typeID));
745 else
746 nullcThrowError("ERROR: type '%s' doesn't implement method '%s%s' of type '%s'", nullcGetTypeName(r.typeID), nullcGetTypeName(r.typeID), strchr(nullcGetFunctionName(funcs[found]), ':'), nullcGetTypeName(nullcGetFunctionType(funcs[found])));
747 return ret;
748 }
749 ret.context = r.ptr;
750 ret.id = funcs[r.typeID];
751 return ret;
752}
753
754NULLC::TypeIDHelper NULLC::Typeid(NULLCRef r)
755{

Callers

nothing calls this directly

Calls 5

strchrFunction · 0.85
nullcGetFunctionNameFunction · 0.85
nullcGetFunctionTypeFunction · 0.85
nullcThrowErrorFunction · 0.70
nullcGetTypeNameFunction · 0.50

Tested by

no test coverage detected