aboutsummaryrefslogtreecommitdiff
path: root/src/compile/lists.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-10-01 13:05:48 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-10-01 13:05:48 -0400
commit6be5430c131311106d720a4573e7509bd8b5a346 (patch)
tree16bf786e5ff69bcc93e05b34a3253c5b6268dbdd /src/compile/lists.c
parentfb32f766501e089953e8cb0353e60af7bc8fc042 (diff)
Fix up some more none cases
Diffstat (limited to 'src/compile/lists.c')
-rw-r--r--src/compile/lists.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/compile/lists.c b/src/compile/lists.c
index 7bbf0471..d9fb46a3 100644
--- a/src/compile/lists.c
+++ b/src/compile/lists.c
@@ -20,7 +20,7 @@ static ast_t *add_to_list_comprehension(ast_t *item, ast_t *subject) {
public
Text_t compile_typed_list(env_t *env, ast_t *ast, type_t *list_type) {
DeclareMatch(list, ast, List);
- if (!list->items) return Text("(List_t){.has_value=1, .length=0}");
+ if (!list->items) return Text("EMPTY_LIST");
type_t *item_type = Match(list_type, ListType)->item_type;
@@ -48,7 +48,7 @@ list_comprehension: {
LiteralCode(Texts("&", comprehension_name), .type = Type(PointerType, .pointed = list_type, .is_stack = true));
Closure_t comp_action = {.fn = add_to_list_comprehension, .userdata = comprehension_var};
scope->comprehension_action = &comp_action;
- Text_t code = Texts("({ List_t ", comprehension_name, " = {.has_value=1};");
+ Text_t code = Texts("({ List_t ", comprehension_name, " = EMPTY_LIST;");
// set_binding(scope, comprehension_name, list_type, comprehension_name);
for (ast_list_t *item = list->items; item; item = item->next) {
if (item->ast->tag == Comprehension) code = Texts(code, "\n", compile_statement(scope, item->ast));