commit 5135238f86c3fd3de423f5d04fe22717f2eb59ae (tree)
parent 8980f150e94f5542f5228e371fd2919a9922dc12
Author: Andrew Kelley <andrew@ziglang.org>
Date: Fri, 15 May 2020 19:11:00 -0400
ZIR: emit proper string literals
Diffstat:
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/src-self-hosted/ir/text.zig b/src-self-hosted/ir/text.zig
@@ -1456,6 +1456,21 @@ const EmitZIR = struct {
.kw_args = .{},
};
try self.decls.append(self.allocator, &str_inst.base);
- return &str_inst.base;
+
+ const ref_inst = try self.arena.allocator.create(Inst.Ref);
+ ref_inst.* = .{
+ .base = .{
+ .name = try self.autoName(),
+ .src = src,
+ .tag = Inst.Ref.base_tag,
+ },
+ .positionals = .{
+ .operand = &str_inst.base,
+ },
+ .kw_args = .{},
+ };
+ try self.decls.append(self.allocator, &ref_inst.base);
+
+ return &ref_inst.base;
}
};