feature. See also
. The project being documented here (as the example) is the Zig library itself.
AstGen.typeCast
fn typeCast(
gz: *GenZir,
scope: *Scope,
ri: ResultInfo,
node: Ast.Node.Index,
operand_node: Ast.Node.Index,
tag: Zir.Inst.Tag,
builtin_name: []const u8,
) InnerError!Zir.Inst.Ref
File
Code
fn typeCast(
gz: *GenZir,
scope: *Scope,
ri: ResultInfo,
node: Ast.Node.Index,
operand_node: Ast.Node.Index,
tag: Zir.Inst.Tag,
builtin_name: []const u8,
) InnerError!Zir.Inst.Ref {
const cursor = maybeAdvanceSourceCursorToMainToken(gz, node);
const result_type = try ri.rl.resultTypeForCast(gz, node, builtin_name);
const operand = try expr(gz, scope, .{ .rl = .none }, operand_node);
try emitDbgStmt(gz, cursor);
const result = try gz.addPlNode(tag, node, Zir.Inst.Bin{
.lhs = result_type,
.rhs = operand,
});
return rvalue(gz, ri, result, node);
}