mirror of
https://github.com/ziglang/zig.git
synced 2025-12-17 03:33:06 +00:00
Autodoc: not all block_inlines contain a break_inline
This commit is contained in:
parent
52b8efc726
commit
e01ec96288
@ -7940,7 +7940,9 @@ fn builtinCall(
|
|||||||
},
|
},
|
||||||
|
|
||||||
.src => {
|
.src => {
|
||||||
maybeAdvanceSourceCursorToMainToken(gz, node);
|
const token_starts = tree.tokens.items(.start);
|
||||||
|
const node_start = token_starts[tree.firstToken(node)];
|
||||||
|
astgen.advanceSourceCursor(node_start);
|
||||||
const result = try gz.addExtendedPayload(.builtin_src, Zir.Inst.Src{
|
const result = try gz.addExtendedPayload(.builtin_src, Zir.Inst.Src{
|
||||||
.node = gz.nodeIndexToRelative(node),
|
.node = gz.nodeIndexToRelative(node),
|
||||||
.line = astgen.source_line,
|
.line = astgen.source_line,
|
||||||
|
|||||||
@ -2129,7 +2129,15 @@ fn walkInstruction(
|
|||||||
file,
|
file,
|
||||||
parent_scope,
|
parent_scope,
|
||||||
parent_src,
|
parent_src,
|
||||||
getBlockInlineBreak(file.zir, inst_index),
|
getBlockInlineBreak(file.zir, inst_index) orelse {
|
||||||
|
const res = DocData.WalkResult{ .expr = .{
|
||||||
|
.comptimeExpr = self.comptime_exprs.items.len,
|
||||||
|
} };
|
||||||
|
try self.comptime_exprs.append(self.arena, .{
|
||||||
|
.code = "if (...) { ... }",
|
||||||
|
});
|
||||||
|
return res;
|
||||||
|
},
|
||||||
need_type,
|
need_type,
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@ -3155,7 +3163,7 @@ fn walkDecls(
|
|||||||
2 => {
|
2 => {
|
||||||
// decl test
|
// decl test
|
||||||
const decl_being_tested = scope.resolveDeclName(doc_comment_index);
|
const decl_being_tested = scope.resolveDeclName(doc_comment_index);
|
||||||
const func_index = getBlockInlineBreak(file.zir, value_index);
|
const func_index = getBlockInlineBreak(file.zir, value_index).?;
|
||||||
|
|
||||||
const pl_node = data[Zir.refToIndex(func_index).?].pl_node;
|
const pl_node = data[Zir.refToIndex(func_index).?].pl_node;
|
||||||
const fn_src = try self.srcLocInfo(file, pl_node.src_node, decl_src);
|
const fn_src = try self.srcLocInfo(file, pl_node.src_node, decl_src);
|
||||||
@ -4301,12 +4309,13 @@ fn walkRef(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn getBlockInlineBreak(zir: Zir, inst_index: usize) Zir.Inst.Ref {
|
fn getBlockInlineBreak(zir: Zir, inst_index: usize) ?Zir.Inst.Ref {
|
||||||
const tags = zir.instructions.items(.tag);
|
const tags = zir.instructions.items(.tag);
|
||||||
const data = zir.instructions.items(.data);
|
const data = zir.instructions.items(.data);
|
||||||
const pl_node = data[inst_index].pl_node;
|
const pl_node = data[inst_index].pl_node;
|
||||||
const extra = zir.extraData(Zir.Inst.Block, pl_node.payload_index);
|
const extra = zir.extraData(Zir.Inst.Block, pl_node.payload_index);
|
||||||
const break_index = zir.extra[extra.end..][extra.data.body_len - 1];
|
const break_index = zir.extra[extra.end..][extra.data.body_len - 1];
|
||||||
|
if (tags[break_index] == .condbr_inline) return null;
|
||||||
std.debug.assert(tags[break_index] == .break_inline);
|
std.debug.assert(tags[break_index] == .break_inline);
|
||||||
return data[break_index].@"break".operand;
|
return data[break_index].@"break".operand;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user