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

json: fix struct field default value support (#14304)

This commit is contained in:
StunxFS
2022-05-20 04:22:17 -04:00
committed by GitHub
parent ca00b59b3f
commit 11bdb04d0c
5 changed files with 103 additions and 25 deletions

View File

@@ -40,11 +40,6 @@ fn (mut p Parser) struct_decl() ast.StructDecl {
return ast.StructDecl{}
}
mut name := p.check_name()
// defer {
// if name.contains('App') {
// println('end of struct decl $name')
// }
// }
if name.len == 1 && name[0].is_capital() {
p.error_with_pos('single letter capital names are reserved for generic template types.',
name_pos)
@@ -328,9 +323,7 @@ fn (mut p Parser) struct_decl() ast.StructDecl {
p.error_with_pos('invalid recursive struct `$orig_name`', name_pos)
return ast.StructDecl{}
}
mut ret := 0
// println('reg type symbol $name mod=$p.mod')
ret = p.table.register_sym(t)
mut ret := p.table.register_sym(t)
// allow duplicate c struct declarations
if ret == -1 && language != .c {
p.error_with_pos('cannot register struct `$name`, another type with this name exists',