diff options
Diffstat (limited to 'lib/std')
| -rw-r--r-- | lib/std/zig/AstGen.zig | 9 | ||||
| -rw-r--r-- | lib/std/zig/AstRlAnnotate.zig | 7 | ||||
| -rw-r--r-- | lib/std/zig/BuiltinFn.zig | 8 |
3 files changed, 23 insertions, 1 deletions
diff --git a/lib/std/zig/AstGen.zig b/lib/std/zig/AstGen.zig index 7e11f8d44b..16d2a99632 100644 --- a/lib/std/zig/AstGen.zig +++ b/lib/std/zig/AstGen.zig @@ -9274,6 +9274,15 @@ fn builtinCall( }); return rvalue(gz, ri, result, node); }, + .FieldType => { + const ty_inst = try typeExpr(gz, scope, params[0]); + const name_inst = try comptimeExpr(gz, scope, .{ .rl = .{ .coerced_ty = .slice_const_u8_type } }, params[1]); + const result = try gz.addPlNode(.field_type_ref, node, Zir.Inst.FieldTypeRef{ + .container_type = ty_inst, + .field_name = name_inst, + }); + return rvalue(gz, ri, result, node); + }, // zig fmt: off .as => return as( gz, scope, ri, node, params[0], params[1]), diff --git a/lib/std/zig/AstRlAnnotate.zig b/lib/std/zig/AstRlAnnotate.zig index 104cea1154..68d423ade7 100644 --- a/lib/std/zig/AstRlAnnotate.zig +++ b/lib/std/zig/AstRlAnnotate.zig @@ -914,7 +914,6 @@ fn builtinCall(astrl: *AstRlAnnotate, block: ?*Block, ri: ResultInfo, node: Ast. .work_item_id, .work_group_size, .work_group_id, - .field_parent_ptr, => { _ = try astrl.expr(args[0], block, ResultInfo.type_only); return false; @@ -983,11 +982,17 @@ fn builtinCall(astrl: *AstRlAnnotate, block: ?*Block, ri: ResultInfo, node: Ast. .has_decl, .has_field, .field, + .FieldType, => { _ = try astrl.expr(args[0], block, ResultInfo.type_only); _ = try astrl.expr(args[1], block, ResultInfo.type_only); return false; }, + .field_parent_ptr => { + _ = try astrl.expr(args[0], block, ResultInfo.type_only); + _ = try astrl.expr(args[1], block, ResultInfo.none); + return false; + }, .wasm_memory_grow => { _ = try astrl.expr(args[0], block, ResultInfo.type_only); _ = try astrl.expr(args[1], block, ResultInfo.type_only); diff --git a/lib/std/zig/BuiltinFn.zig b/lib/std/zig/BuiltinFn.zig index 6b0d0cc0a2..236092fb13 100644 --- a/lib/std/zig/BuiltinFn.zig +++ b/lib/std/zig/BuiltinFn.zig @@ -50,6 +50,7 @@ pub const Tag = enum { @"extern", field, field_parent_ptr, + FieldType, float_cast, int_from_float, frame, @@ -517,6 +518,13 @@ pub const list = list: { }, }, .{ + "@FieldType", + .{ + .tag = .FieldType, + .param_count = 2, + }, + }, + .{ "@floatCast", .{ .tag = .float_cast, |
