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

parser: add type check for +=, -=, *=, /=

This commit is contained in:
SleepyRoy
2020-02-19 05:14:52 +08:00
committed by GitHub
parent 19520ccf4e
commit aaf3ced750
2 changed files with 20 additions and 0 deletions

View File

@ -189,6 +189,7 @@ const (
integer_types = ['int', 'i8', 'char', 'byte', 'i16', 'u16', 'u32', 'i64', 'u64']
float_types = ['f32', 'f64']
reserved_type_param_names = ['R', 'S', 'T', 'U', 'W']
pointer_types = ['byte*', 'byteptr', 'char*', 'charptr', 'void*', 'voidptr', 'voidptr*', 'intptr']
)
fn is_number_type(typ string) bool {
@ -207,6 +208,10 @@ fn is_primitive_type(typ string) bool {
return is_number_type(typ) || typ == 'string'
}
fn is_pointer_type(typ string) bool {
return typ in pointer_types
}
/*
fn (t mut Table) register_enum_val(typ, val string) {
if t.enum_vals.len == 0 {