Add a new method call operator, and more.
The '.' operator now represents method calls. A function f: (a, b)->c can be called as a.f(b), which is equivalent to f(a, b). Besides this change, all reserved operators now have a negative precedence (it's relative, remember?), and some function names were changed.
This commit is contained in:
@@ -70,11 +70,25 @@ libab_result libab_interpreter_run(libab_interpreter* intr, libab_tree* tree,
|
||||
* @param into the reference to store the result into.
|
||||
* @return the result of the call.
|
||||
*/
|
||||
libab_result libab_interpreter_run_function(libab_interpreter* intr,
|
||||
libab_result libab_interpreter_call_function(libab_interpreter* intr,
|
||||
libab_ref* scope,
|
||||
const char* function,
|
||||
libab_ref_vec* params,
|
||||
libab_ref* into);
|
||||
/**
|
||||
* Calls a function value with the given parameters.
|
||||
* @param intr the interpreter to use to call the function.
|
||||
* @param scope the scope in which the function should be searched for.
|
||||
* @param function the function to call.
|
||||
* @param params the parameters to pass to the function.
|
||||
* @param into the reference to store the result into.
|
||||
* @return the result of the call.
|
||||
*/
|
||||
libab_result libab_interpreter_call_value(libab_interpreter* intr,
|
||||
libab_ref* scope,
|
||||
libab_ref* function,
|
||||
libab_ref_vec* params,
|
||||
libab_ref* into);
|
||||
/**
|
||||
* Gets the unit value from this interpreter.
|
||||
* @param intr the interpreter from which to get the unit value.
|
||||
|
||||
@@ -263,7 +263,7 @@ libab_result libab_run_tree(libab* ab, libab_tree* tree, libab_ref* value);
|
||||
* @param param_count the number of parameters given to this function.
|
||||
* @return the result of the call.
|
||||
*/
|
||||
libab_result libab_run_function(libab* ab, const char* function,
|
||||
libab_result libab_call_function(libab* ab, const char* function,
|
||||
libab_ref* into,
|
||||
size_t param_count, ...);
|
||||
/**
|
||||
@@ -293,7 +293,7 @@ libab_result libab_run_tree_scoped(libab* ab, libab_tree* tree, libab_ref* scope
|
||||
* @param param_count the number of parameters given to this function.
|
||||
* @return the result of the call.
|
||||
*/
|
||||
libab_result libab_run_function_scoped(libab* ab, const char* function, libab_ref* scope,
|
||||
libab_result libab_call_function_scoped(libab* ab, const char* function, libab_ref* scope,
|
||||
libab_ref* into,
|
||||
size_t param_count, ...);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user