mirror of
https://github.com/ziglang/zig.git
synced 2026-01-20 14:25:16 +00:00
autodoc: Handle ref ZIR instruction
This commit is contained in:
parent
6df78c3bc1
commit
8a9aa9e112
@ -1361,6 +1361,12 @@ Happy writing!
|
||||
return;
|
||||
}
|
||||
|
||||
case "ref": {
|
||||
yield { src: "&", tag: Tag.ampersand };
|
||||
yield* ex(zigAnalysis.exprs[expr.ref], opts);
|
||||
return;
|
||||
}
|
||||
|
||||
case "call": {
|
||||
|
||||
let call = zigAnalysis.calls[expr.call];
|
||||
|
||||
@ -797,6 +797,7 @@ const DocData = struct {
|
||||
binOp: BinOp,
|
||||
binOpIndex: usize,
|
||||
load: usize, // index in `exprs`
|
||||
ref: usize, // index in `exprs`
|
||||
const BinOp = struct {
|
||||
lhs: usize, // index in `exprs`
|
||||
rhs: usize, // index in `exprs`
|
||||
@ -1521,6 +1522,23 @@ fn walkInstruction(
|
||||
.expr = .{ .load = load_idx },
|
||||
};
|
||||
},
|
||||
.ref => {
|
||||
const un_tok = data[inst_index].un_tok;
|
||||
const operand = try self.walkRef(
|
||||
file,
|
||||
parent_scope,
|
||||
parent_src,
|
||||
un_tok.operand,
|
||||
need_type,
|
||||
call_ctx,
|
||||
);
|
||||
const ref_idx = self.exprs.items.len;
|
||||
try self.exprs.append(self.arena, operand.expr);
|
||||
|
||||
return DocData.WalkResult{
|
||||
.expr = .{ .ref = ref_idx },
|
||||
};
|
||||
},
|
||||
|
||||
// @check array_cat and array_mul
|
||||
.add,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user