| ... | ... | @@ -3193,7 +3193,6 @@ fn fnDecl( |
| 3193 | 3193 | // missing function name already happened in scanDecls() |
| 3194 | 3194 | const fn_name_token = fn_proto.name_token orelse return error.AnalysisFail; |
| 3195 | 3195 | const fn_name_str_index = try astgen.identAsString(fn_name_token); |
| 3196 | | const doc_comment_index = try astgen.docCommentAsString(fn_name_token - 1); |
| 3197 | 3196 | |
| 3198 | 3197 | // We insert this at the beginning so that its instruction index marks the |
| 3199 | 3198 | // start of the top level declaration. |
| ... | ... | @@ -3237,6 +3236,13 @@ fn fnDecl( |
| 3237 | 3236 | const maybe_inline_token = fn_proto.extern_export_inline_token orelse break :blk false; |
| 3238 | 3237 | break :blk token_tags[maybe_inline_token] == .keyword_inline; |
| 3239 | 3238 | }; |
| 3239 | |
| 3240 | const doc_comment_index = try astgen.docCommentAsString(fn_name_token - 1 - |
| 3241 | @boolToInt(is_pub) - |
| 3242 | @boolToInt(is_export) - |
| 3243 | @boolToInt(is_extern) - |
| 3244 | @boolToInt(has_inline_keyword)); // TODO subtract noinline too |
| 3245 | |
| 3240 | 3246 | const has_section_or_addrspace = fn_proto.ast.section_expr != 0 or fn_proto.ast.addrspace_expr != 0; |
| 3241 | 3247 | wip_members.nextDecl(is_pub, is_export, fn_proto.ast.align_expr != 0, has_section_or_addrspace); |
| 3242 | 3248 | |
| ... | ... | @@ -3474,7 +3480,6 @@ fn globalVarDecl( |
| 3474 | 3480 | |
| 3475 | 3481 | const name_token = var_decl.ast.mut_token + 1; |
| 3476 | 3482 | const name_str_index = try astgen.identAsString(name_token); |
| 3477 | | const doc_comment_index = try astgen.docCommentAsString(var_decl.ast.mut_token); |
| 3478 | 3483 | |
| 3479 | 3484 | var block_scope: GenZir = .{ |
| 3480 | 3485 | .parent = scope, |
| ... | ... | @@ -3522,6 +3527,12 @@ fn globalVarDecl( |
| 3522 | 3527 | break :blk lib_name_str.index; |
| 3523 | 3528 | } else 0; |
| 3524 | 3529 | |
| 3530 | const doc_comment_index = try astgen.docCommentAsString(var_decl.ast.mut_token - |
| 3531 | @boolToInt(is_pub) - |
| 3532 | @boolToInt(is_export) - |
| 3533 | @boolToInt(lib_name != 0) - |
| 3534 | @boolToInt(is_threadlocal)); |
| 3535 | |
| 3525 | 3536 | assert(var_decl.comptime_token == null); // handled by parser |
| 3526 | 3537 | |
| 3527 | 3538 | const var_inst: Zir.Inst.Ref = if (var_decl.ast.init_node != 0) vi: { |