fn resultType(rl: Loc, gz: *GenZir, node: Ast.Node.Index) !?Zir.Inst.Ref
Find the result type for a cast builtin given the result location. If the location does not have a known result type, returns null.
null
rl: Loc
gz: *GenZir
node: Ast.Node.Index
346 347 348 349 350 351 352 353 354 355 356
fn resultType(rl: Loc, gz: *GenZir, node: Ast.Node.Index) !?Zir.Inst.Ref { return switch (rl) { .discard, .none, .ref, .ref_const, .inferred_ptr, .destructure => null, .ty, .coerced_ty => |ty_ref| ty_ref, .ref_coerced_ty => |ptr_ty| try gz.addUnNode(.elem_type, ptr_ty, node), .ptr => |ptr| { const ptr_ty = try gz.addUnNode(.typeof, ptr.inst, node); return try gz.addUnNode(.elem_type, ptr_ty, node); }, }; }
Find the result type for a cast builtin given the result location. If the location does not have a known result type, returns
null.