aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-18 23:31:36 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-18 23:31:36 -0400
commit9e07c6adc7a0616eec40e78024a8501ec7d96559 (patch)
tree92542ba27e13152a8305deb6f0cda3a952ac8835 /compile.c
parent1f16d63ac783d9b1bb1d4a65676476d14f0af713 (diff)
Add Channel:peek()
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/compile.c b/compile.c
index 08b56938..477913c7 100644
--- a/compile.c
+++ b/compile.c
@@ -2377,6 +2377,10 @@ CORD compile(env_t *env, ast_t *ast)
CORD self = compile_to_pointer_depth(env, call->self, 0, false);
(void)compile_arguments(env, ast, NULL, call->args);
return CORD_all("Channel$get_value(", self, ", ", compile_type(item_t), ", ", padded_item_size, ")");
+ } else if (streq(call->name, "peek")) {
+ CORD self = compile_to_pointer_depth(env, call->self, 0, false);
+ (void)compile_arguments(env, ast, NULL, call->args);
+ return CORD_all("Channel$peek_value(", self, ", ", compile_type(item_t), ")");
} else if (streq(call->name, "clear")) {
CORD self = compile_to_pointer_depth(env, call->self, 0, false);
(void)compile_arguments(env, ast, NULL, call->args);