changeset 179:53dc68a0488d

expr: Add yexpr_set_closure
author Lewin Bormann <lbo@spheniscida.de>
date Thu, 12 Sep 2019 08:25:03 +0200
parents d9c942e7f1ad
children 6eb17b273514
files src/expr.h
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/expr.h	Thu Sep 12 08:24:52 2019 +0200
+++ b/src/expr.h	Thu Sep 12 08:25:03 2019 +0200
@@ -29,7 +29,8 @@
 void yexpr_destroy(yexpr_t* v);
 
 /**
- * Return a deep copy of `orig`. References in `orig` are resolved and copied as well.
+ * Return a deep copy of `orig`. References in `orig` are resolved and copied as
+ * well.
  */
 yexpr_t yexpr_copy(yexpr_t* orig);
 
@@ -82,6 +83,13 @@
 void yexpr_set_exception(yexpr_t* v, ystr_t message);
 
 /**
+ * Set the value of `v` to be a closure of the given `funcref` (pointing to a
+ * function) with `captured` values (vector of yexpr_t in order of the
+ * `captured` field of the function).
+ */
+void yexpr_set_closure(yexpr_t* v, yref_t funcref, yvec_t captured);
+
+/**
  * Initialize a yexpr_t value if not yet done and append another value to it.
  *
  * Invariants: `v` must be of type `YEXPR_LIST` or `YEXPR_UNDEF`.
@@ -110,7 +118,8 @@
 void yexpr_debug(yexpr_t* expr);
 
 /**
- * Return a string representation of `expr`. The caller owns the returned string.
+ * Return a string representation of `expr`. The caller owns the returned
+ * string.
  */
 ystr_t yexpr_debug_str(yexpr_t* expr);