aboutsummaryrefslogtreecommitdiff
path: root/typecheck.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 /typecheck.c
parent1f16d63ac783d9b1bb1d4a65676476d14f0af713 (diff)
Add Channel:peek()
Diffstat (limited to 'typecheck.c')
-rw-r--r--typecheck.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/typecheck.c b/typecheck.c
index 805f83e0..2fb8556d 100644
--- a/typecheck.c
+++ b/typecheck.c
@@ -774,6 +774,7 @@ type_t *get_type(env_t *env, ast_t *ast)
else if (streq(call->name, "get")) return Match(self_value_t, ChannelType)->item_type;
else if (streq(call->name, "give")) return Type(VoidType);
else if (streq(call->name, "give_all")) return Type(VoidType);
+ else if (streq(call->name, "peek")) return Match(self_value_t, ChannelType)->item_type;
else if (streq(call->name, "view")) return Type(ArrayType, .item_type=Match(self_value_t, ChannelType)->item_type);
else code_err(ast, "There is no '%s' method for arrays", call->name);
}