aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-10 16:36:50 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-10 16:36:50 -0400
commit948d6b4c22b07d0ec7affd79b29ba0200f3498fa (patch)
tree0908cf76f535ac0a9e828cf33720cf91fd9d4a74 /compile.c
parent4265728cbbe80dd993ef38ef60e32a06e57cb7ff (diff)
Add array:counts()
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 0cd34235..30868d52 100644
--- a/compile.c
+++ b/compile.c
@@ -2028,6 +2028,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("Table$from_entries(", self, ", $SetInfo(", compile_type_info(env, item_t), "))");
+ } else if (streq(call->name, "counts")) {
+ CORD self = compile_to_pointer_depth(env, call->self, 0, false);
+ (void)compile_arguments(env, ast, NULL, call->args);
+ return CORD_all("Array$counts(", self, ", ", compile_type_info(env, self_value_t), ")");
} else code_err(ast, "There is no '%s' method for arrays", call->name);
}
case SetType: {