Add utilities to reuse common internal function code.
This commit is contained in:
@@ -438,8 +438,6 @@ libab_result _interpreter_call_function(struct interpreter_state* state, libab_r
|
||||
if(result == LIBAB_SUCCESS) {
|
||||
libab_ref_free(into);
|
||||
result = _interpreter_cast_and_perform_call(function, params, &temp_new_types, into);
|
||||
} else {
|
||||
printf("Failed check. %d\n", result);
|
||||
}
|
||||
|
||||
libab_ref_vec_free(&temp_new_types);
|
||||
|
||||
14
src/util.c
14
src/util.c
@@ -309,3 +309,17 @@ libab_result libab_put_table_value(libab_table* table, const char* key,
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void* libab_unwrap_value(libab_ref* ref) {
|
||||
libab_value* value = libab_ref_get(ref);
|
||||
return libab_ref_get(&value->data);
|
||||
}
|
||||
|
||||
void* libab_unwrap_param(libab_ref_vec* vec, size_t index) {
|
||||
libab_ref temp;
|
||||
void* data;
|
||||
libab_ref_vec_index(vec, index, &temp);
|
||||
data = libab_unwrap_value(&temp);
|
||||
libab_ref_free(&temp);
|
||||
return data;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user