| ... | @@ -2421,6 +2421,8 @@ pub const Inst = struct { | ... | @@ -2421,6 +2421,8 @@ pub const Inst = struct { |
| 2421 | /// - 0 means comptime or usingnamespace decl. | 2421 | /// - 0 means comptime or usingnamespace decl. |
| 2422 | /// - if name == 0 `is_exported` determines which one: 0=comptime,1=usingnamespace | 2422 | /// - if name == 0 `is_exported` determines which one: 0=comptime,1=usingnamespace |
| 2423 | /// - 1 means test decl with no name. | 2423 | /// - 1 means test decl with no name. |
| | 2424 | /// - if there is a 0 byte at the position `name` indexes, it indicates |
| | 2425 | /// this is a test decl, and the name starts at `name+1`. |
| 2424 | /// value: Index, | 2426 | /// value: Index, |
| 2425 | /// align: Ref, // if corresponding bit is set | 2427 | /// align: Ref, // if corresponding bit is set |
| 2426 | /// link_section: Ref, // if corresponding bit is set | 2428 | /// link_section: Ref, // if corresponding bit is set |
| ... | @@ -2459,6 +2461,8 @@ pub const Inst = struct { | ... | @@ -2459,6 +2461,8 @@ pub const Inst = struct { |
| 2459 | /// - 0 means comptime or usingnamespace decl. | 2461 | /// - 0 means comptime or usingnamespace decl. |
| 2460 | /// - if name == 0 `is_exported` determines which one: 0=comptime,1=usingnamespace | 2462 | /// - if name == 0 `is_exported` determines which one: 0=comptime,1=usingnamespace |
| 2461 | /// - 1 means test decl with no name. | 2463 | /// - 1 means test decl with no name. |
| | 2464 | /// - if there is a 0 byte at the position `name` indexes, it indicates |
| | 2465 | /// this is a test decl, and the name starts at `name+1`. |
| 2462 | /// value: Index, | 2466 | /// value: Index, |
| 2463 | /// align: Ref, // if corresponding bit is set | 2467 | /// align: Ref, // if corresponding bit is set |
| 2464 | /// link_section: Ref, // if corresponding bit is set | 2468 | /// link_section: Ref, // if corresponding bit is set |
| ... | @@ -2492,6 +2496,8 @@ pub const Inst = struct { | ... | @@ -2492,6 +2496,8 @@ pub const Inst = struct { |
| 2492 | /// - 0 means comptime or usingnamespace decl. | 2496 | /// - 0 means comptime or usingnamespace decl. |
| 2493 | /// - if name == 0 `is_exported` determines which one: 0=comptime,1=usingnamespace | 2497 | /// - if name == 0 `is_exported` determines which one: 0=comptime,1=usingnamespace |
| 2494 | /// - 1 means test decl with no name. | 2498 | /// - 1 means test decl with no name. |
| | 2499 | /// - if there is a 0 byte at the position `name` indexes, it indicates |
| | 2500 | /// this is a test decl, and the name starts at `name+1`. |
| 2495 | /// value: Index, | 2501 | /// value: Index, |
| 2496 | /// align: Ref, // if corresponding bit is set | 2502 | /// align: Ref, // if corresponding bit is set |
| 2497 | /// link_section: Ref, // if corresponding bit is set | 2503 | /// link_section: Ref, // if corresponding bit is set |
| ... | @@ -2535,8 +2541,9 @@ pub const Inst = struct { | ... | @@ -2535,8 +2541,9 @@ pub const Inst = struct { |
| 2535 | /// - 0 means comptime or usingnamespace decl. | 2541 | /// - 0 means comptime or usingnamespace decl. |
| 2536 | /// - if name == 0 `is_exported` determines which one: 0=comptime,1=usingnamespace | 2542 | /// - if name == 0 `is_exported` determines which one: 0=comptime,1=usingnamespace |
| 2537 | /// - 1 means test decl with no name. | 2543 | /// - 1 means test decl with no name. |
| | 2544 | /// - if there is a 0 byte at the position `name` indexes, it indicates |
| | 2545 | /// this is a test decl, and the name starts at `name+1`. |
| 2538 | /// value: Index, | 2546 | /// value: Index, |
| 2539 | /// - one of: block_inline | | |
| 2540 | /// align: Ref, // if corresponding bit is set | 2547 | /// align: Ref, // if corresponding bit is set |
| 2541 | /// link_section: Ref, // if corresponding bit is set | 2548 | /// link_section: Ref, // if corresponding bit is set |
| 2542 | /// } | 2549 | /// } |
| ... | @@ -3631,7 +3638,6 @@ const Writer = struct { | ... | @@ -3631,7 +3638,6 @@ const Writer = struct { |
| 3631 | const line = self.code.extra[extra_index]; | 3638 | const line = self.code.extra[extra_index]; |
| 3632 | extra_index += 1; | 3639 | extra_index += 1; |
| 3633 | const decl_name_index = self.code.extra[extra_index]; | 3640 | const decl_name_index = self.code.extra[extra_index]; |
| 3634 | const decl_name = self.code.nullTerminatedString(decl_name_index); | | |
| 3635 | extra_index += 1; | 3641 | extra_index += 1; |
| 3636 | const decl_index = self.code.extra[extra_index]; | 3642 | const decl_index = self.code.extra[extra_index]; |
| 3637 | extra_index += 1; | 3643 | extra_index += 1; |
| ... | @@ -3653,10 +3659,18 @@ const Writer = struct { | ... | @@ -3653,10 +3659,18 @@ const Writer = struct { |
| 3653 | const name = if (is_exported) "usingnamespace" else "comptime"; | 3659 | const name = if (is_exported) "usingnamespace" else "comptime"; |
| 3654 | try stream.writeAll(pub_str); | 3660 | try stream.writeAll(pub_str); |
| 3655 | try stream.writeAll(name); | 3661 | try stream.writeAll(name); |
| | 3662 | } else if (decl_name_index == 1) { |
| | 3663 | try stream.writeAll("test"); |
| 3656 | } else { | 3664 | } else { |
| | 3665 | const raw_decl_name = self.code.nullTerminatedString(decl_name_index); |
| | 3666 | const decl_name = if (raw_decl_name.len == 0) |
| | 3667 | self.code.nullTerminatedString(decl_name_index + 1) |
| | 3668 | else |
| | 3669 | raw_decl_name; |
| | 3670 | const test_str = if (raw_decl_name.len == 0) "test " else ""; |
| 3657 | const export_str = if (is_exported) "export " else ""; | 3671 | const export_str = if (is_exported) "export " else ""; |
| 3658 | try stream.print("{s}{s}{}", .{ | 3672 | try stream.print("{s}{s}{s}{}", .{ |
| 3659 | pub_str, export_str, std.zig.fmtId(decl_name), | 3673 | pub_str, test_str, export_str, std.zig.fmtId(decl_name), |
| 3660 | }); | 3674 | }); |
| 3661 | if (align_inst != .none) { | 3675 | if (align_inst != .none) { |
| 3662 | try stream.writeAll(" align("); | 3676 | try stream.writeAll(" align("); |