| ... | @@ -1388,12 +1388,15 @@ fn walkDecls( | ... | @@ -1388,12 +1388,15 @@ fn walkDecls( |
| 1388 | // const pub_str = if (is_pub) "pub " else ""; | 1388 | // const pub_str = if (is_pub) "pub " else ""; |
| 1389 | // const hash_bytes = @bitCast([16]u8, hash_u32s.*); | 1389 | // const hash_bytes = @bitCast([16]u8, hash_u32s.*); |
| 1390 | | 1390 | |
| | 1391 | var is_test = false; // we discover if it's a test by lookin at its name |
| 1391 | const name: []const u8 = blk: { | 1392 | const name: []const u8 = blk: { |
| 1392 | if (decl_name_index == 0) { | 1393 | if (decl_name_index == 0) { |
| 1393 | break :blk if (is_exported) "usingnamespace" else "comptime"; | 1394 | break :blk if (is_exported) "usingnamespace" else "comptime"; |
| 1394 | } else if (decl_name_index == 1) { | 1395 | } else if (decl_name_index == 1) { |
| | 1396 | is_test = true; |
| 1395 | break :blk "test"; | 1397 | break :blk "test"; |
| 1396 | } else if (decl_name_index == 2) { | 1398 | } else if (decl_name_index == 2) { |
| | 1399 | is_test = true; |
| 1397 | // it is a decltest | 1400 | // it is a decltest |
| 1398 | const decl_being_tested = scope.resolveDeclName(doc_comment_index); | 1401 | const decl_being_tested = scope.resolveDeclName(doc_comment_index); |
| 1399 | const ast_node_index = idx: { | 1402 | const ast_node_index = idx: { |
| ... | @@ -1471,6 +1474,7 @@ fn walkDecls( | ... | @@ -1471,6 +1474,7 @@ fn walkDecls( |
| 1471 | } else { | 1474 | } else { |
| 1472 | const raw_decl_name = file.zir.nullTerminatedString(decl_name_index); | 1475 | const raw_decl_name = file.zir.nullTerminatedString(decl_name_index); |
| 1473 | if (raw_decl_name.len == 0) { | 1476 | if (raw_decl_name.len == 0) { |
| | 1477 | is_test = true; |
| 1474 | break :blk file.zir.nullTerminatedString(decl_name_index + 1); | 1478 | break :blk file.zir.nullTerminatedString(decl_name_index + 1); |
| 1475 | } else { | 1479 | } else { |
| 1476 | break :blk raw_decl_name; | 1480 | break :blk raw_decl_name; |
| ... | @@ -1496,7 +1500,10 @@ fn walkDecls( | ... | @@ -1496,7 +1500,10 @@ fn walkDecls( |
| 1496 | break :idx idx; | 1500 | break :idx idx; |
| 1497 | }; | 1501 | }; |
| 1498 | | 1502 | |
| 1499 | const walk_result = try self.walkInstruction(file, scope, decl_index); | 1503 | const walk_result = if (is_test) // TODO: decide if tests should show up at all |
| | 1504 | DocData.WalkResult{ .void = {} } |
| | 1505 | else |
| | 1506 | try self.walkInstruction(file, scope, decl_index); |
| 1500 | | 1507 | |
| 1501 | if (is_pub) { | 1508 | if (is_pub) { |
| 1502 | try decl_indexes.append(self.arena, decls_slot_index); | 1509 | try decl_indexes.append(self.arena, decls_slot_index); |