diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2022-03-01 14:03:32 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2022-03-01 14:03:32 -0700 |
| commit | 18e42661dc9b8199311ee086b24ef5c85cf4708f (patch) | |
| tree | 9a9a32ea7b4e58e733cd5548a2be5d2102385c66 /src/AstGen.zig | |
| parent | 543bee0adf2d3b036654fa0983c16ff7023f504c (diff) | |
| download | zig-18e42661dc9b8199311ee086b24ef5c85cf4708f.tar.gz zig-18e42661dc9b8199311ee086b24ef5c85cf4708f.zip | |
Sema: eliminate use of resolveAlreadyCoercedInt
Diffstat (limited to 'src/AstGen.zig')
| -rw-r--r-- | src/AstGen.zig | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/src/AstGen.zig b/src/AstGen.zig index e8d612fbc7..5de68e43e5 100644 --- a/src/AstGen.zig +++ b/src/AstGen.zig @@ -290,6 +290,7 @@ pub const ResultLoc = union(enum) { }; pub const align_rl: ResultLoc = .{ .ty = .u16_type }; +pub const coerced_align_rl: ResultLoc = .{ .coerced_ty = .u16_type }; pub const bool_rl: ResultLoc = .{ .ty = .bool_type }; pub const type_rl: ResultLoc = .{ .ty = .type_type }; pub const coerced_type_rl: ResultLoc = .{ .coerced_ty = .type_type }; @@ -2971,7 +2972,7 @@ fn ptrType( trailing_count += 1; } if (ptr_info.ast.align_node != 0) { - align_ref = try expr(gz, scope, align_rl, ptr_info.ast.align_node); + align_ref = try expr(gz, scope, coerced_align_rl, ptr_info.ast.align_node); trailing_count += 1; } if (ptr_info.ast.addrspace_node != 0) { @@ -2980,8 +2981,8 @@ fn ptrType( } if (ptr_info.ast.bit_range_start != 0) { assert(ptr_info.ast.bit_range_end != 0); - bit_start_ref = try expr(gz, scope, .none, ptr_info.ast.bit_range_start); - bit_end_ref = try expr(gz, scope, .none, ptr_info.ast.bit_range_end); + bit_start_ref = try expr(gz, scope, .{ .coerced_ty = .u16_type }, ptr_info.ast.bit_range_start); + bit_end_ref = try expr(gz, scope, .{ .coerced_ty = .u16_type }, ptr_info.ast.bit_range_end); trailing_count += 2; } @@ -7122,7 +7123,7 @@ fn builtinCall( .error_to_int => return simpleUnOp(gz, scope, rl, node, .none, params[0], .error_to_int), .int_to_error => return simpleUnOp(gz, scope, rl, node, .{ .ty = .u16_type }, params[0], .int_to_error), .compile_error => return simpleUnOp(gz, scope, rl, node, .{ .ty = .const_slice_u8_type }, params[0], .compile_error), - .set_eval_branch_quota => return simpleUnOp(gz, scope, rl, node, .{ .ty = .u32_type }, params[0], .set_eval_branch_quota), + .set_eval_branch_quota => return simpleUnOp(gz, scope, rl, node, .{ .coerced_ty = .u32_type }, params[0], .set_eval_branch_quota), .enum_to_int => return simpleUnOp(gz, scope, rl, node, .none, params[0], .enum_to_int), .bool_to_int => return simpleUnOp(gz, scope, rl, node, bool_rl, params[0], .bool_to_int), .embed_file => return simpleUnOp(gz, scope, rl, node, .{ .ty = .const_slice_u8_type }, params[0], .embed_file), @@ -7437,7 +7438,7 @@ fn builtinCall( }, .Vector => { const result = try gz.addPlNode(.vector_type, node, Zir.Inst.Bin{ - .lhs = try comptimeExpr(gz, scope, .{ .ty = .u32_type }, params[0]), + .lhs = try comptimeExpr(gz, scope, .{ .coerced_ty = .u32_type }, params[0]), .rhs = try typeExpr(gz, scope, params[1]), }); return rvalue(gz, rl, result, node); |
