From 0dff0507356d1ceb187ac48337c67bdfbb895fac Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Thu, 14 Apr 2022 16:42:29 +0300 Subject: [PATCH] builtin: u8/byte clean up --- vlib/v/ast/ast.v | 2 +- vlib/v/ast/types.v | 14 +++++++------- vlib/v/checker/check_types.v | 2 +- vlib/v/checker/comptime.v | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/vlib/v/ast/ast.v b/vlib/v/ast/ast.v index 25844c74b5..2b64e4cb41 100644 --- a/vlib/v/ast/ast.v +++ b/vlib/v/ast/ast.v @@ -2179,7 +2179,7 @@ pub fn (expr Expr) is_literal() bool { CastExpr { return !expr.has_arg && expr.expr.is_literal() && (expr.typ.is_ptr() || expr.typ.is_pointer() - || expr.typ in [i8_type, i16_type, int_type, i64_type, byte_type, u8_type, u16_type, u32_type, u64_type, f32_type, f64_type, char_type, bool_type, rune_type]) + || expr.typ in [i8_type, i16_type, int_type, i64_type, byte_type, u16_type, u32_type, u64_type, f32_type, f64_type, char_type, bool_type, rune_type]) } SizeOf, IsRefType { return expr.is_type || expr.expr.is_literal() diff --git a/vlib/v/ast/types.v b/vlib/v/ast/types.v index 4b032c3c38..3e39826fa8 100644 --- a/vlib/v/ast/types.v +++ b/vlib/v/ast/types.v @@ -441,7 +441,7 @@ pub const ( int_literal_type_idx = 27 thread_type_idx = 28 error_type_idx = 29 - u8_type_idx = 30 + // u8_type_idx = 30 ) // Note: builtin_type_names must be in the same order as the idx consts above @@ -453,15 +453,15 @@ pub const builtin_type_names_matcher = build_builtin_type_names_matcher() pub const ( integer_type_idxs = [i8_type_idx, i16_type_idx, int_type_idx, i64_type_idx, - byte_type_idx, u8_type_idx, u16_type_idx, u32_type_idx, u64_type_idx, isize_type_idx, - usize_type_idx, int_literal_type_idx, rune_type_idx] + byte_type_idx, u16_type_idx, u32_type_idx, u64_type_idx, isize_type_idx, usize_type_idx, + int_literal_type_idx, rune_type_idx] signed_integer_type_idxs = [char_type_idx, i8_type_idx, i16_type_idx, int_type_idx, i64_type_idx, isize_type_idx] - unsigned_integer_type_idxs = [byte_type_idx, u8_type_idx, u16_type_idx, u32_type_idx, - u64_type_idx, usize_type_idx] + unsigned_integer_type_idxs = [byte_type_idx, u16_type_idx, u32_type_idx, u64_type_idx, + usize_type_idx] // C will promote any type smaller than int to int in an expression int_promoted_type_idxs = [char_type_idx, i8_type_idx, i16_type_idx, byte_type_idx, - u8_type_idx, u16_type_idx] + u16_type_idx] float_type_idxs = [f32_type_idx, f64_type_idx, float_literal_type_idx] number_type_idxs = [i8_type_idx, i16_type_idx, int_type_idx, i64_type_idx, byte_type_idx, char_type_idx, u16_type_idx, u32_type_idx, u64_type_idx, isize_type_idx, @@ -483,7 +483,7 @@ pub const ( i64_type = new_type(i64_type_idx) isize_type = new_type(isize_type_idx) byte_type = new_type(byte_type_idx) - u8_type = new_type(u8_type_idx) + // u8_type = new_type(u8_type_idx) u16_type = new_type(u16_type_idx) u32_type = new_type(u32_type_idx) u64_type = new_type(u64_type_idx) diff --git a/vlib/v/checker/check_types.v b/vlib/v/checker/check_types.v index 0ee6d63656..3af359ab29 100644 --- a/vlib/v/checker/check_types.v +++ b/vlib/v/checker/check_types.v @@ -394,7 +394,7 @@ fn (mut c Checker) check_shift(mut node ast.InfixExpr, left_type ast.Type, right ast.i64_type { 63 } // ast.byte_type { 7 } - ast.u8_type { 7 } + // ast.u8_type { 7 } ast.u16_type { 15 } ast.u32_type { 31 } ast.u64_type { 63 } diff --git a/vlib/v/checker/comptime.v b/vlib/v/checker/comptime.v index 49db3f5265..2ff3cb7fdf 100644 --- a/vlib/v/checker/comptime.v +++ b/vlib/v/checker/comptime.v @@ -143,7 +143,7 @@ fn (mut c Checker) eval_comptime_const_expr(expr ast.Expr, nlevel int) ?ast.Comp ast.i64_type { return 8 } // ast.byte_type { return 1 } - ast.u8_type { return 1 } + // ast.u8_type { return 1 } ast.u16_type { return 2 } ast.u32_type { return 4 } ast.u64_type { return 8 }