diff options
| author | Timon Kruiper <timonkruiper@gmail.com> | 2021-04-07 14:55:11 +0200 |
|---|---|---|
| committer | Timon Kruiper <timonkruiper@gmail.com> | 2021-04-08 14:23:18 +0200 |
| commit | e85cd616ef6439fdb9e7ac118251bb7c2296e553 (patch) | |
| tree | b3661a2f77897e6fcd2483838713193ed0784a5c /src/AstGen.zig | |
| parent | a97efbd1850cbf12dbf9332f7da2652385a38cd6 (diff) | |
| download | zig-e85cd616ef6439fdb9e7ac118251bb7c2296e553.tar.gz zig-e85cd616ef6439fdb9e7ac118251bb7c2296e553.zip | |
stage2: implement builtin function hasDecl
Diffstat (limited to 'src/AstGen.zig')
| -rw-r--r-- | src/AstGen.zig | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig index 364f76cc7a..20e52ea559 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -1245,6 +1245,7 @@ fn blockExprStmts( .fn_type_var_args, .fn_type_cc, .fn_type_cc_var_args, + .has_decl, .int, .float, .float128, @@ -4159,6 +4160,16 @@ fn builtinCall( return rvalue(gz, scope, rl, .void_value, node); }, + .has_decl => { + const container_type = try typeExpr(gz, scope, params[0]); + const name = try comptimeExpr(gz, scope, .{ .ty = .const_slice_u8_type }, params[1]); + const result = try gz.addPlNode(.has_decl, node, zir.Inst.Bin{ + .lhs = container_type, + .rhs = name, + }); + return rvalue(gz, scope, rl, result, node); + }, + .add_with_overflow, .align_cast, .align_of, @@ -4191,7 +4202,6 @@ fn builtinCall( .fence, .field_parent_ptr, .float_to_int, - .has_decl, .has_field, .int_to_float, .int_to_ptr, |
