diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-09-03 03:53:36 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-09-03 03:53:36 -0400 |
| commit | 5feecff9d93522002c74a1423d138c2aa8bc150d (patch) | |
| tree | ff64b7695be5fd8716cfe6ed640ed556dc203587 /compile.c | |
| parent | 5f0b099e1444d462be5aa8df49f87c9b324e1b85 (diff) | |
Deprecate `Where` and change channel API to use a boolean `front` value
Diffstat (limited to 'compile.c')
| -rw-r--r-- | compile.c | 14 |
1 files changed, 6 insertions, 8 deletions
@@ -2404,28 +2404,26 @@ CORD compile(env_t *env, ast_t *ast) case ChannelType: { type_t *item_t = Match(self_value_t, ChannelType)->item_type; CORD padded_item_size = CORD_asprintf("%ld", padded_type_size(item_t)); - arg_t *where_default_end = new(arg_t, .name="where", .type=WHERE_TYPE, - .default_val=FakeAST(FieldAccess, .fielded=FakeAST(Var, "Where"), .field="End")); - arg_t *where_default_start = new(arg_t, .name="where", .type=WHERE_TYPE, - .default_val=FakeAST(FieldAccess, .fielded=FakeAST(Var, "Where"), .field="Start")); + arg_t *front_default_end = new(arg_t, .name="front", .type=Type(BoolType), .default_val=FakeAST(Bool, false)); + arg_t *front_default_start = new(arg_t, .name="front", .type=Type(BoolType), .default_val=FakeAST(Bool, true)); if (streq(call->name, "give")) { CORD self = compile_to_pointer_depth(env, call->self, 0, false); - arg_t *arg_spec = new(arg_t, .name="item", .type=item_t, .next=where_default_end); + arg_t *arg_spec = new(arg_t, .name="item", .type=item_t, .next=front_default_end); return CORD_all("Channel$give_value(", self, ", ", compile_arguments(env, ast, arg_spec, call->args), ", ", padded_item_size, ")"); } else if (streq(call->name, "give_all")) { CORD self = compile_to_pointer_depth(env, call->self, 0, false); - arg_t *arg_spec = new(arg_t, .name="to_give", .type=Type(ArrayType, .item_type=item_t), .next=where_default_end); + arg_t *arg_spec = new(arg_t, .name="to_give", .type=Type(ArrayType, .item_type=item_t), .next=front_default_end); return CORD_all("Channel$give_all(", self, ", ", compile_arguments(env, ast, arg_spec, call->args), ", ", padded_item_size, ")"); } else if (streq(call->name, "get")) { CORD self = compile_to_pointer_depth(env, call->self, 0, false); - arg_t *arg_spec = where_default_start; + arg_t *arg_spec = front_default_start; return CORD_all("Channel$get_value(", self, ", ", compile_arguments(env, ast, arg_spec, call->args), ", ", compile_type(item_t), ", ", padded_item_size, ")"); } else if (streq(call->name, "peek")) { CORD self = compile_to_pointer_depth(env, call->self, 0, false); - arg_t *arg_spec = where_default_start; + arg_t *arg_spec = front_default_start; return CORD_all("Channel$peek_value(", self, ", ", compile_arguments(env, ast, arg_spec, call->args), ", ", compile_type(item_t), ")"); } else if (streq(call->name, "clear")) { |
