From 50bcfb8c906be67a044ff4bef857a8d6d615de71 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Thu, 1 Apr 2021 11:58:55 -0700 Subject: stage2: implement struct init syntax with ptr result loc --- src/Module.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/Module.zig') diff --git a/src/Module.zig b/src/Module.zig index 8037785232..ebb4b2dc1d 100644 --- a/src/Module.zig +++ b/src/Module.zig @@ -1046,6 +1046,16 @@ pub const Scope = struct { gz.astgen.extra.appendSliceAssumeCapacity(gz.instructions.items); } + pub fn identAsString(gz: *GenZir, ident_token: ast.TokenIndex) !u32 { + const astgen = gz.astgen; + const gpa = astgen.mod.gpa; + const string_bytes = &astgen.string_bytes; + const str_index = @intCast(u32, string_bytes.items.len); + try astgen.mod.appendIdentStr(&gz.base, ident_token, string_bytes); + try string_bytes.append(gpa, 0); + return str_index; + } + pub fn addFnTypeCc(gz: *GenZir, tag: zir.Inst.Tag, args: struct { src_node: ast.Node.Index, param_types: []const zir.Inst.Ref, -- cgit v1.2.3