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

Function __redirect

NULLC/translation/runtime.cpp:714–742  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

712}
713
714NULLCFuncPtr<> __redirect(NULLCRef r, NULLCArray<int>* arr, void* unused)
715{
716 unsigned int *funcs = (unsigned int*)arr->ptr;
717 NULLCFuncPtr<> ret;
718 if(r.typeID > arr->size)
719 {
720 nullcThrowError("ERROR: type index is out of bounds of redirection table");
721 return ret;
722 }
723 // If there is no implementation for a method
724 if(!funcs[r.typeID])
725 {
726 // Find implemented function ID as a type reference
727 unsigned int found = 0;
728 for(; found < arr->size; found++)
729 {
730 if(funcs[found])
731 break;
732 }
733 //if(found == arr->size)
734 nullcThrowError("ERROR: type '%s' doesn't implement method", nullcGetTypeName(r.typeID));
735 //else
736 // 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])));
737 return ret;
738 }
739 ret.context = r.ptr;
740 ret.id = funcs[r.typeID];
741 return ret;
742}
743
744
745NULLCArray<char>* __operatorSet(NULLCArray<char>* dst, NULLCArray<int> src, void* unused)

Callers

nothing calls this directly

Calls 2

nullcThrowErrorFunction · 0.70
nullcGetTypeNameFunction · 0.70

Tested by

no test coverage detected