1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

remove u8 and i32 from tests and examples

This commit is contained in:
Alexander Medvednikov
2019-09-02 15:02:25 +03:00
parent 0db1eaa55a
commit 1c6d51f271
12 changed files with 38 additions and 43 deletions

View File

@ -73,16 +73,13 @@ void pthread_mutex_unlock(HANDLE *m) {
//================================== TYPEDEFS ================================*/
typedef unsigned char byte;
typedef unsigned int uint;
typedef int64_t i64;
typedef int32_t i32;
typedef int16_t i16;
typedef int8_t i8;
typedef uint64_t u64;
typedef uint32_t u32;
typedef uint16_t u16;
typedef uint8_t u8;
typedef uint8_t byte;
typedef uint32_t rune;
typedef float f32;
typedef double f64;
@ -94,8 +91,6 @@ typedef struct map map;
typedef array array_string;
typedef array array_int;
typedef array array_byte;
typedef array array_uint;
typedef array array_float;
typedef array array_f32;
typedef array array_f64;
typedef map map_int;

View File

@ -1619,8 +1619,8 @@ fn (p mut Parser) name_expr() string {
if orig_name == 'i32' {
println('`i32` alias was removed, use `int` instead')
}
if orig_name == 'u8' {
println('`u8` alias was removed, use `byte` instead')
if orig_name == 'byte' {
println('`byte` alias was removed, use `byte` instead')
}
p.error('undefined: `$orig_name`')
}
@ -1949,7 +1949,7 @@ fn (p mut Parser) index_expr(typ_ string, fn_ph int) string {
if is_arr {
index_pos := p.cgen.cur_line.len
T := p.table.find_type(p.expression())
// Allows only i8-64 and u8-64 to be used when accessing an array
// Allows only i8-64 and byte-64 to be used when accessing an array
if T.parent != 'int' && T.parent != 'u32' {
p.check_types(T.name, 'int')
}

View File

@ -758,7 +758,7 @@ fn (table &Table) cgen_name_type_pair(name, typ string) string {
fn is_valid_int_const(val, typ string) bool {
x := val.int()
switch typ {
case 'u8': return 0 <= x && x <= math.MaxU8
case 'byte': return 0 <= x && x <= math.MaxU8
case 'u16': return 0 <= x && x <= math.MaxU16
//case 'u32': return 0 <= x && x <= math.MaxU32
//case 'u64': return 0 <= x && x <= math.MaxU64

View File

@ -46,4 +46,4 @@ fn test_flag_parsing() {
for i, f in flags {
assert f == result[i]
}
}
}