aboutsummaryrefslogtreecommitdiff
path: root/compile.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-15 02:17:53 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-15 02:17:53 -0400
commited1667cb377dd8da51583e703c6677969addc993 (patch)
tree531424aa9647ef49549000bb145e2b798c868154 /compile.c
parent7a472752e5be47816f756d854a1b0756594fef98 (diff)
Add array:shuffled() and checks for array insertion
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 f7589ea7..7ed64325 100644
--- a/compile.c
+++ b/compile.c
@@ -2122,6 +2122,10 @@ CORD compile(env_t *env, ast_t *ast)
CORD self = compile_to_pointer_depth(env, call->self, 1, false);
(void)compile_arguments(env, ast, NULL, call->args);
return CORD_all("Array$shuffle(", self, ", ", padded_item_size, ")");
+ } else if (streq(call->name, "shuffled")) {
+ CORD self = compile_to_pointer_depth(env, call->self, 0, false);
+ (void)compile_arguments(env, ast, NULL, call->args);
+ return CORD_all("Array$shuffled(", self, ", ", padded_item_size, ")");
} else if (streq(call->name, "sort") || streq(call->name, "sorted")) {
CORD self = compile_to_pointer_depth(env, call->self, streq(call->name, "sort") ? 1 : 0, false);
CORD comparison;