feature. See also
. The project being documented here (as the example) is the Zig library itself.
AstGen.addFailedDeclaration
fn addFailedDeclaration(
wip_decls: *WipDecls,
gz: *GenZir,
kind: Zir.Inst.Declaration.Unwrapped.Kind,
name: Zir.NullTerminatedString,
src_node: Ast.Node.Index,
is_pub: bool,
) !void
File
Code
fn addFailedDeclaration(
wip_decls: *WipDecls,
gz: *GenZir,
kind: Zir.Inst.Declaration.Unwrapped.Kind,
name: Zir.NullTerminatedString,
src_node: Ast.Node.Index,
is_pub: bool,
) !void {
const decl_inst = try gz.makeDeclaration(src_node);
wip_decls.nextDecl(decl_inst);
var dummy_gz = gz.makeSubBlock(&gz.base);
var value_gz = gz.makeSubBlock(&gz.base);
_ = try value_gz.add(.{
.tag = .extended,
.data = .{ .extended = .{
.opcode = .astgen_error,
.small = undefined,
.operand = undefined,
} },
});
try setDeclaration(decl_inst, .{
.src_hash = @splat(0),
.src_line = gz.astgen.source_line,
.src_column = gz.astgen.source_column,
.kind = kind,
.name = name,
.is_pub = is_pub,
.is_threadlocal = false,
.linkage = .normal,
.type_gz = &dummy_gz,
.align_gz = &dummy_gz,
.linksection_gz = &dummy_gz,
.addrspace_gz = &dummy_gz,
.value_gz = &value_gz,
});
}