aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/AstGen.zig4
-rw-r--r--src/Zir.zig2
-rw-r--r--src/print_zir.zig6
3 files changed, 12 insertions, 0 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig
index c6b4e6e866..5a05209f4c 100644
--- a/src/AstGen.zig
+++ b/src/AstGen.zig
@@ -9721,8 +9721,12 @@ const GenZir = struct {
try gz.astgen.extra.ensureUnusedCapacity(gpa, @typeInfo(Zir.Inst.Param).Struct.fields.len +
param_body.len);
+ const doc_comment_index = try gz.astgen.docCommentAsString(abs_tok_index -
+ @boolToInt(tag == .param_comptime));
+
const payload_index = gz.astgen.addExtraAssumeCapacity(Zir.Inst.Param{
.name = name,
+ .doc_comment = doc_comment_index,
.body_len = @intCast(u32, param_body.len),
});
gz.astgen.extra.appendSliceAssumeCapacity(param_body);
diff --git a/src/Zir.zig b/src/Zir.zig
index b50a63163f..05c4f2c5fb 100644
--- a/src/Zir.zig
+++ b/src/Zir.zig
@@ -2906,6 +2906,8 @@ pub const Inst = struct {
pub const Param = struct {
/// Null-terminated string index.
name: u32,
+ /// 0 if no doc comment
+ doc_comment: u32,
/// The body contains the type of the parameter.
body_len: u32,
};
diff --git a/src/print_zir.zig b/src/print_zir.zig
index 9fd6b61231..7ce459568b 100644
--- a/src/print_zir.zig
+++ b/src/print_zir.zig
@@ -785,6 +785,12 @@ const Writer = struct {
try stream.print("\"{}\", ", .{
std.zig.fmtEscapes(self.code.nullTerminatedString(extra.data.name)),
});
+
+ if (extra.data.doc_comment != 0) {
+ try stream.writeAll("\n");
+ try self.writeDocComment(stream, extra.data.doc_comment);
+ try stream.writeByteNTimes(' ', self.indent);
+ }
try self.writeBracedBody(stream, body);
try stream.writeAll(") ");
try self.writeSrc(stream, inst_data.src());