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

parser: C enums + another enum simplification

This commit is contained in:
Alexander Medvednikov
2019-11-06 04:43:13 +03:00
parent 91bb969ed1
commit 855a736a2c
6 changed files with 31 additions and 26 deletions

View File

@ -37,11 +37,12 @@ fn (p mut Parser) struct_decl() {
}
is_c := name == 'C' && p.tok == .dot
if is_c {
/*
if !p.pref.building_v && !p.fileis('vlib') {
p.warn('Virtual C structs will soon be removed from the language' +
'\ndefine the C structs and functions in V')
}
*/
p.check(.dot)
name = p.check_name()
cat = .c_struct
@ -264,6 +265,7 @@ fn (p mut Parser) struct_init(typ string) string {
p.gen_struct_field_init(field)
p.check(.colon)
p.fspace()
p.expected_type = f.typ
p.check_types(p.bool_expression(), f.typ)
if p.tok == .comma {
p.next()