diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-08-15 03:01:04 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-08-15 03:01:04 -0400 |
| commit | 688f883e16e98a94c9654fa2bf6fc8257f01e2e6 (patch) | |
| tree | bd2bf0ea244eebaa308e5489fd99c418395def38 /compile.c | |
| parent | 66ae30ac29d93ac7346bbb465e6c49f540ec4079 (diff) | |
Add array:find()
Diffstat (limited to 'compile.c')
| -rw-r--r-- | compile.c | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -2194,6 +2194,11 @@ 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$clear(", self, ")"); + } else if (streq(call->name, "find")) { + CORD self = compile_to_pointer_depth(env, call->self, 0, false); + arg_t *arg_spec = new(arg_t, .name="item", .type=item_t); + return CORD_all("Array$find_value(", self, ", ", compile_arguments(env, ast, arg_spec, call->args), + ", ", compile_type_info(env, self_value_t), ")"); } else if (streq(call->name, "from")) { CORD self = compile_to_pointer_depth(env, call->self, 0, false); arg_t *arg_spec = new(arg_t, .name="first", .type=INT_TYPE); |
