| author | |
| committer | |
| log | 1e9811070be35463e5cf4dfd284d9313e0621ded |
| tree | a8c7969270a16c1dfa945cc168cc4fc533e7fa56 |
| parent | 4bfd37ddb48af4dbfd2e892aec7a90a822c8cbe7 |
| parent | df4849c4f5aafc7eb80fd7b2299b49162fa2aa79 |
| signature |
AstGen: fix branch on undefined4 files changed, 16 insertions(+), 3 deletions(-)
src/AstGen.zig+9-1| ... | ... | @@ -2905,7 +2905,15 @@ fn deferStmt( |
| 2905 | 2905 | const sub_scope = if (!have_err_code) &defer_gen.base else blk: { |
| 2906 | 2906 | try gz.addDbgBlockBegin(); |
| 2907 | 2907 | const ident_name = try gz.astgen.identAsString(payload_token); |
| 2908 | remapped_err_code = @intCast(u32, try gz.astgen.instructions.addOne(gz.astgen.gpa)); | |
| 2908 | remapped_err_code = @intCast(Zir.Inst.Index, gz.astgen.instructions.len); | |
| 2909 | try gz.astgen.instructions.append(gz.astgen.gpa, .{ | |
| 2910 | .tag = .extended, | |
| 2911 | .data = .{ .extended = .{ | |
| 2912 | .opcode = .errdefer_err_code, | |
| 2913 | .small = undefined, | |
| 2914 | .operand = undefined, | |
| 2915 | } }, | |
| 2916 | }); | |
| 2909 | 2917 | const remapped_err_code_ref = Zir.indexToRef(remapped_err_code); |
| 2910 | 2918 | local_val_scope = .{ |
| 2911 | 2919 | .parent = &defer_gen.base, |
src/Sema.zig+1| ... | ... | @@ -1198,6 +1198,7 @@ fn analyzeBodyInner( |
| 1198 | 1198 | i += 1; |
| 1199 | 1199 | continue; |
| 1200 | 1200 | }, |
| 1201 | .errdefer_err_code => unreachable, // never appears in a body | |
| 1201 | 1202 | }; |
| 1202 | 1203 | }, |
| 1203 | 1204 |
src/Zir.zig+5-2| ... | ... | @@ -1979,7 +1979,7 @@ pub const Inst = struct { |
| 1979 | 1979 | /// `operand` is `src_node: i32`. |
| 1980 | 1980 | breakpoint, |
| 1981 | 1981 | /// Implements the `@select` builtin. |
| 1982 | /// operand` is payload index to `Select`. | |
| 1982 | /// `operand` is payload index to `Select`. | |
| 1983 | 1983 | select, |
| 1984 | 1984 | /// Implement builtin `@errToInt`. |
| 1985 | 1985 | /// `operand` is payload index to `UnNode`. |
| ... | ... | @@ -1999,7 +1999,7 @@ pub const Inst = struct { |
| 1999 | 1999 | /// `operand` is payload index to `Cmpxchg`. |
| 2000 | 2000 | cmpxchg, |
| 2001 | 2001 | /// Implement the builtin `@addrSpaceCast` |
| 2002 | /// `Operand` is payload index to `BinNode`. `lhs` is dest type, `rhs` is operand. | |
| 2002 | /// `operand` is payload index to `BinNode`. `lhs` is dest type, `rhs` is operand. | |
| 2003 | 2003 | addrspace_cast, |
| 2004 | 2004 | /// Implement builtin `@cVaArg`. |
| 2005 | 2005 | /// `operand` is payload index to `BinNode`. |
| ... | ... | @@ -2031,6 +2031,9 @@ pub const Inst = struct { |
| 2031 | 2031 | /// Implements the `@inComptime` builtin. |
| 2032 | 2032 | /// `operand` is `src_node: i32`. |
| 2033 | 2033 | in_comptime, |
| 2034 | /// Used as a placeholder for the capture of an `errdefer`. | |
| 2035 | /// This is replaced by Sema with the captured value. | |
| 2036 | errdefer_err_code, | |
| 2034 | 2037 | |
| 2035 | 2038 | pub const InstData = struct { |
| 2036 | 2039 | opcode: Extended, |
src/print_zir.zig+1| ... | ... | @@ -467,6 +467,7 @@ const Writer = struct { |
| 467 | 467 | .breakpoint, |
| 468 | 468 | .c_va_start, |
| 469 | 469 | .in_comptime, |
| 470 | .errdefer_err_code, | |
| 470 | 471 | => try self.writeExtNode(stream, extended), |
| 471 | 472 | |
| 472 | 473 | .builtin_src => { |