Make overloading code a utility function and call from interpreter.

This fixes #10.
This commit is contained in:
2018-09-13 16:08:49 -07:00
parent 25dd70f040
commit 4425b27b52
4 changed files with 102 additions and 79 deletions

View File

@@ -103,6 +103,17 @@ libab_result libab_create_value_ref(libab* ab, libab_ref* into,
*/
libab_result libab_create_value_raw(libab* ab, libab_ref* into,
void* data, libab_ref* type);
/**
* Overloads a function of the given name.
* @param table the table to insert the function into.
* @param name the name of the function.
* @param function the function to register.
* @return the result of the overload.
*/
libab_result libab_overload_function(libab* ab,
libab_table* table,
const char* name,
libab_ref* function);
/**
* Allocates a function that uses internal code to run.
* @param into the reference into which to store the new function.