| author | |
| committer | |
| log | ba55e32ef2d8ed5875bff8524fbbb05c6d8afd40 |
| tree | 69ebd7c14a837c3d3d2e148df4a6037429140054 |
| parent | 1f56ff8343ef07d2d04d4a596b3f03f61230a753 |
3 files changed, 12 insertions(+), 0 deletions(-)
src/AstGen.zig+4| ... | @@ -9721,8 +9721,12 @@ const GenZir = struct { | ... | @@ -9721,8 +9721,12 @@ const GenZir = struct { |
| 9721 | try gz.astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Param).Struct.fields.len + | 9721 | try gz.astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Param).Struct.fields.len + |
| 9722 | param_body.len); | 9722 | param_body.len); |
| 9723 | 9723 | ||
| 9724 | const doc_comment_index = try gz.astgen.docCommentAsString(abs_tok_index - | ||
| 9725 | @boolToInt(tag == .param_comptime)); | ||
| 9726 | |||
| 9724 | const payload_index = gz.astgen.addExtraAssumeCapacity(Zir.Inst.Param{ | 9727 | const payload_index = gz.astgen.addExtraAssumeCapacity(Zir.Inst.Param{ |
| 9725 | .name = name, | 9728 | .name = name, |
| 9729 | .doc_comment = doc_comment_index, | ||
| 9726 | .body_len = @intCast(u32, param_body.len), | 9730 | .body_len = @intCast(u32, param_body.len), |
| 9727 | }); | 9731 | }); |
| 9728 | gz.astgen.extra.appendSliceAssumeCapacity(param_body); | 9732 | gz.astgen.extra.appendSliceAssumeCapacity(param_body); |
src/Zir.zig+2| ... | @@ -2906,6 +2906,8 @@ pub const Inst = struct { | ... | @@ -2906,6 +2906,8 @@ pub const Inst = struct { |
| 2906 | pub const Param = struct { | 2906 | pub const Param = struct { |
| 2907 | /// Null-terminated string index. | 2907 | /// Null-terminated string index. |
| 2908 | name: u32, | 2908 | name: u32, |
| 2909 | /// 0 if no doc comment | ||
| 2910 | doc_comment: u32, | ||
| 2909 | /// The body contains the type of the parameter. | 2911 | /// The body contains the type of the parameter. |
| 2910 | body_len: u32, | 2912 | body_len: u32, |
| 2911 | }; | 2913 | }; |
src/print_zir.zig+6| ... | @@ -785,6 +785,12 @@ const Writer = struct { | ... | @@ -785,6 +785,12 @@ const Writer = struct { |
| 785 | try stream.print("\"{}\", ", .{ | 785 | try stream.print("\"{}\", ", .{ |
| 786 | std.zig.fmtEscapes(self.code.nullTerminatedString(extra.data.name)), | 786 | std.zig.fmtEscapes(self.code.nullTerminatedString(extra.data.name)), |
| 787 | }); | 787 | }); |
| 788 | |||
| 789 | if (extra.data.doc_comment != 0) { | ||
| 790 | try stream.writeAll("\n"); | ||
| 791 | try self.writeDocComment(stream, extra.data.doc_comment); | ||
| 792 | try stream.writeByteNTimes(' ', self.indent); | ||
| 793 | } | ||
| 788 | try self.writeBracedBody(stream, body); | 794 | try self.writeBracedBody(stream, body); |
| 789 | try stream.writeAll(") "); | 795 | try stream.writeAll(") "); |
| 790 | try self.writeSrc(stream, inst_data.src()); | 796 | try self.writeSrc(stream, inst_data.src()); |