From 602cedd03b0c3d6ef176efafb08f51bde9bfe543 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 17 Aug 2025 16:54:57 -0400 Subject: Fix List.slice() --- src/compile.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/compile.c b/src/compile.c index 1648363a..cc9a7bd6 100644 --- a/src/compile.c +++ b/src/compile.c @@ -3337,6 +3337,10 @@ Text_t compile(env_t *env, ast_t *ast) self = compile_to_pointer_depth(env, call->self, 0, true); arg_t *arg_spec = new(arg_t, .name="last", .type=INT_TYPE); return Texts("List$to(", self, ", ", compile_arguments(env, ast, arg_spec, call->args), ")"); + } else if (streq(call->name, "slice")) { + self = compile_to_pointer_depth(env, call->self, 0, true); + arg_t *arg_spec = new(arg_t, .name="first", .type=INT_TYPE, .next=new(arg_t, .name="last", .type=INT_TYPE)); + return Texts("List$slice(", self, ", ", compile_arguments(env, ast, arg_spec, call->args), ")"); } else if (streq(call->name, "by")) { self = compile_to_pointer_depth(env, call->self, 0, true); arg_t *arg_spec = new(arg_t, .name="stride", .type=INT_TYPE); -- cgit v1.2.3