aboutsummaryrefslogtreecommitdiff
path: root/src/AstGen.zig
diff options
context:
space:
mode:
authorjacob gw <jacoblevgw@gmail.com>2021-03-26 17:54:41 -0400
committerAndrew Kelley <andrew@ziglang.org>2021-03-28 18:22:01 -0700
commit0005b346375f1fbe7bc42c22d658e3218bbd599d (patch)
treed88211b36f2be7689a138bf0d5f1a2e62f695323 /src/AstGen.zig
parentf80f8a7a7835db5f8b13aab23b4ee79e88c25e63 (diff)
downloadzig-0005b346375f1fbe7bc42c22d658e3218bbd599d.tar.gz
zig-0005b346375f1fbe7bc42c22d658e3218bbd599d.zip
stage2: implement sema for @errorToInt and @intToError
Diffstat (limited to 'src/AstGen.zig')
-rw-r--r--src/AstGen.zig14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig
index 82f606e7dc..b01834ab79 100644
--- a/src/AstGen.zig
+++ b/src/AstGen.zig
@@ -1237,6 +1237,8 @@ fn blockExprStmts(
.bit_not,
.error_set,
.error_value,
+ .error_to_int,
+ .int_to_error,
.slice_start,
.slice_end,
.slice_sentinel,
@@ -3370,6 +3372,16 @@ fn builtinCall(
const result = try gz.addUnNode(.import, target, node);
return rvalue(gz, scope, rl, result, node);
},
+ .error_to_int => {
+ const target = try expr(gz, scope, .none, params[0]);
+ const result = try gz.addUnNode(.error_to_int, target, node);
+ return rvalue(gz, scope, rl, result, node);
+ },
+ .int_to_error => {
+ const target = try expr(gz, scope, .{ .ty = .u16_type }, params[0]);
+ const result = try gz.addUnNode(.int_to_error, target, node);
+ return rvalue(gz, scope, rl, result, node);
+ },
.compile_error => {
const target = try expr(gz, scope, .none, params[0]);
const result = try gz.addUnNode(.compile_error, target, node);
@@ -3439,7 +3451,6 @@ fn builtinCall(
.enum_to_int,
.error_name,
.error_return_trace,
- .error_to_int,
.err_set_cast,
.@"export",
.fence,
@@ -3448,7 +3459,6 @@ fn builtinCall(
.has_decl,
.has_field,
.int_to_enum,
- .int_to_error,
.int_to_float,
.int_to_ptr,
.memcpy,