Add scopes to functions.
This commit is contained in:
@@ -94,6 +94,10 @@ struct libab_function_s {
|
||||
* if it was created via partial application.
|
||||
*/
|
||||
libab_ref_vec params;
|
||||
/**
|
||||
* The scope in which this function was declared.
|
||||
*/
|
||||
libab_ref scope;
|
||||
};
|
||||
|
||||
typedef enum libab_operator_variant_e libab_operator_variant;
|
||||
@@ -143,18 +147,22 @@ void libab_operator_free(libab_operator* op);
|
||||
* Initializes a function with the given internal behavior.
|
||||
* @param function the function to initialize.
|
||||
* @param fun the function implementation.
|
||||
* @param the parent scope in which this function was declared.
|
||||
* @return the result of the initialization.
|
||||
*/
|
||||
libab_result libab_function_init_internal(libab_function* function,
|
||||
libab_function_ptr fun);
|
||||
libab_function_ptr fun,
|
||||
libab_ref* scope);
|
||||
/**
|
||||
* Initializes a function with the given tree behavior.
|
||||
* @param function the function to initialize.
|
||||
* @param tree the tree that represents the function's behavior.
|
||||
* @param scope the scope in which this function was declared.
|
||||
* @return the result of the initialization.
|
||||
*/
|
||||
libab_result libab_function_init_tree(libab_function* function,
|
||||
libab_tree* tree);
|
||||
libab_tree* tree,
|
||||
libab_ref* scope);
|
||||
/**
|
||||
* Frees the given function.
|
||||
* @param fun the function to free.
|
||||
|
||||
@@ -96,21 +96,25 @@ libab_result libab_create_value_raw(libab_ref* into, void* data,
|
||||
* @param into the reference into which to store the new function.
|
||||
* @param free_function the free function used to free function instances.
|
||||
* @param fun the function implementation.
|
||||
* @param scope the scope in which this function was declared.
|
||||
* @return libab_result the result of any necessary allocations.
|
||||
*/
|
||||
libab_result libab_create_function_internal(libab_ref* into,
|
||||
void (*free_function)(void*),
|
||||
libab_function_ptr fun);
|
||||
libab_function_ptr fun,
|
||||
libab_ref* scope);
|
||||
/**
|
||||
* Allocates a function that uses a tree to run.
|
||||
* @param into the reference into which to store the new function.
|
||||
* @param free_function the free function used to free function instances.
|
||||
* @param tree the function implementation.
|
||||
* @param scope the scope in which this function was declared.
|
||||
* @return libab_result the result of any necessary allocations.
|
||||
*/
|
||||
libab_result libab_create_function_tree(libab_ref* into,
|
||||
void (*free_function)(void*),
|
||||
libab_tree* tree);
|
||||
libab_tree* tree,
|
||||
libab_ref* scope);
|
||||
/**
|
||||
* Creates a function list object, storing it in to the given reference.
|
||||
* @param into the reference to store into.
|
||||
|
||||
Reference in New Issue
Block a user