aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-03-08 14:25:17 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-03-08 14:25:17 -0500
commit55eacb8a045fe6ae0f048fe3b4247098a49da2b9 (patch)
tree6131a5e156b1b24efd43a8a06a6fa9f2eccabab7 /compile.c
parent07c2b0ec26600d8609870d9f5c0867d48b801db4 (diff)
Array methods
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/compile.c b/compile.c
index 5d1485cc..26266607 100644
--- a/compile.c
+++ b/compile.c
@@ -715,6 +715,12 @@ CORD compile(env_t *env, ast_t *ast)
.next=new(arg_t, .name="at", .type=Type(IntType, .bits=64), .default_val=FakeAST(Int, .i=0, .bits=64)));
return CORD_all("Array__insert(", self, ", ", compile_arguments(env, ast, arg_spec, call->args), ", ",
compile_type_info(env, self_value_t), ")");
+ } else if (streq(call->name, "insert_all")) {
+ CORD self = compile_to_pointer_depth(env, call->self, 1, false);
+ arg_t *arg_spec = new(arg_t, .name="items", .type=self_value_t,
+ .next=new(arg_t, .name="at", .type=Type(IntType, .bits=64), .default_val=FakeAST(Int, .i=0, .bits=64)));
+ return CORD_all("Array__insert_all(", self, ", ", compile_arguments(env, ast, arg_spec, call->args), ", ",
+ compile_type_info(env, self_value_t), ")");
} else if (streq(call->name, "remove")) {
CORD self = compile_to_pointer_depth(env, call->self, 1, false);
arg_t *arg_spec = new(arg_t, .name="index", .type=Type(IntType, .bits=64), .default_val=FakeAST(Int, .i=-1, .bits=64),