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

force () in complex bool expressions: (a && b) || c instead of a && b || c

This commit is contained in:
Alexander Medvednikov
2019-08-04 10:18:31 +02:00
parent 58117f1312
commit 350e13679c
7 changed files with 33 additions and 9 deletions

View File

@ -117,16 +117,16 @@ fn (t &Table) debug_fns() string {
// fn (types array_Type) print_to_file(f string) {
// }
const (
NUMBER_TYPES = ['number', 'int', 'i8', 'u8', 'i16', 'u16', 'i32', 'u32', 'byte', 'i64', 'u64', 'f32', 'f64']
FLOAT_TYPES = ['f32', 'f64']
number_types = ['number', 'int', 'i8', 'u8', 'i16', 'u16', 'i32', 'u32', 'byte', 'i64', 'u64', 'f32', 'f64']
float_types = ['f32', 'f64']
)
fn is_number_type(typ string) bool {
return NUMBER_TYPES.contains(typ)
return typ in number_types
}
fn is_float_type(typ string) bool {
return FLOAT_TYPES.contains(typ)
return typ in float_types
}
fn is_primitive_type(typ string) bool {