aboutsummaryrefslogtreecommitdiff
path: root/src/compile/expressions.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/expressions.c
parentfb32f766501e089953e8cb0353e60af7bc8fc042 (diff)
Fix up some more none cases
Diffstat (limited to 'src/compile/expressions.c')
-rw-r--r--src/compile/expressions.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/compile/expressions.c b/src/compile/expressions.c
index 72fc5e73..b9fafeb8 100644
--- a/src/compile/expressions.c
+++ b/src/compile/expressions.c
@@ -41,9 +41,9 @@ Text_t compile_empty(type_t *t) {
}
case ByteType: return Text("((Byte_t)0)");
case BoolType: return Text("((Bool_t)no)");
- case ListType: return Text("((List_t){.has_value=1})");
- case TableType: return Text("((Table_t){.entries.has_value=1})");
- case TextType: return Text("Text(\"\")");
+ case ListType: return Text("EMPTY_LIST");
+ case TableType: return Text("EMPTY_TABLE");
+ case TextType: return Text("EMPTY_TEXT");
case CStringType: return Text("\"\"");
case PointerType: {
DeclareMatch(ptr, t, PointerType);
@@ -177,7 +177,7 @@ Text_t compile(env_t *env, ast_t *ast) {
}
case List: {
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 *list_type = get_type(env, ast);
return compile_typed_list(env, ast, list_type);
@@ -185,8 +185,8 @@ Text_t compile(env_t *env, ast_t *ast) {
case Table: {
DeclareMatch(table, ast, Table);
if (!table->entries) {
- Text_t code = Text("((Table_t){");
- if (table->fallback) code = Texts(code, ".fallback=heap(", compile(env, table->fallback), ")");
+ Text_t code = Text("((Table_t){.entries=EMPTY_LIST");
+ if (table->fallback) code = Texts(code, ", .fallback=heap(", compile(env, table->fallback), ")");
return Texts(code, "})");
}