aboutsummaryrefslogtreecommitdiff
path: root/src/ir_print.cpp
diff options
context:
space:
mode:
authorAndrew Kelley <superjoe30@gmail.com>2016-11-10 00:41:17 -0500
committerAndrew Kelley <superjoe30@gmail.com>2016-11-10 00:41:17 -0500
commita5c9da0de2d0e2bace3127ba47bd43f5333724c4 (patch)
treef650389e6c59f85261d7b55f1a450c0ec1b9a10a /src/ir_print.cpp
parent9d19b8d66e5eb26ec739ce74b0635270cebf6343 (diff)
downloadzig-a5c9da0de2d0e2bace3127ba47bd43f5333724c4.tar.gz
zig-a5c9da0de2d0e2bace3127ba47bd43f5333724c4.zip
IR: gen string literal
Diffstat (limited to 'src/ir_print.cpp')
-rw-r--r--src/ir_print.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/ir_print.cpp b/src/ir_print.cpp
index f3d030519e..1690bf92e3 100644
--- a/src/ir_print.cpp
+++ b/src/ir_print.cpp
@@ -84,9 +84,22 @@ static void ir_print_const_value(IrPrint *irp, TypeTableEntry *type_entry, Const
fprintf(irp->f, "(scope:%zu:%zu)", node->line + 1, node->column + 1);
break;
}
+ case TypeTableEntryIdArray:
+ {
+ uint64_t len = type_entry->data.array.len;
+ fprintf(irp->f, "%s{", buf_ptr(&type_entry->name));
+ for (uint64_t i = 0; i < len; i += 1) {
+ if (i != 0)
+ fprintf(irp->f, ",");
+ ConstExprValue *child_value = const_val->data.x_array.fields[i];
+ TypeTableEntry *child_type = type_entry->data.array.child_type;
+ ir_print_const_value(irp, child_type, child_value);
+ }
+ fprintf(irp->f, "}");
+ break;
+ }
case TypeTableEntryIdVar:
case TypeTableEntryIdFloat:
- case TypeTableEntryIdArray:
case TypeTableEntryIdStruct:
case TypeTableEntryIdUndefLit:
case TypeTableEntryIdNullLit: