| 722 | } |
| 723 | |
| 724 | NULLCFuncPtr 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 | |
| 754 | NULLC::TypeIDHelper NULLC::Typeid(NULLCRef r) |
| 755 | { |
nothing calls this directly
no test coverage detected