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

Fix deprecated error

This commit is contained in:
Stefanos Baziotis 2019-08-10 14:08:59 +03:00 committed by Alexander Medvednikov
parent 891913e182
commit 02ea168f71

View File

@ -458,6 +458,10 @@ fn (p mut Parser) const_decl() {
fn (p mut Parser) type_decl() { fn (p mut Parser) type_decl() {
p.check(.key_type) p.check(.key_type)
name := p.check_name() name := p.check_name()
// V used to have 'type Foo struct', many Go users might use this syntax
if p.tok == .key_struct {
p.error('use `struct $name {` instead of `type $name struct {`')
}
parent := p.get_type() parent := p.get_type()
nt_pair := p.table.cgen_name_type_pair(name, parent) nt_pair := p.table.cgen_name_type_pair(name, parent)
// TODO dirty C typedef hacks for DOOM // TODO dirty C typedef hacks for DOOM
@ -544,10 +548,6 @@ fn (p mut Parser) struct_decl() {
p.gen_type('$kind $name {') p.gen_type('$kind $name {')
} }
} }
// V used to have 'type Foo struct', many Go users might use this syntax
if !is_c && p.tok == .key_struct {
p.error('use `struct $name {` instead of `type $name struct {`')
}
// Register the type // Register the type
mut typ := p.table.find_type(name) mut typ := p.table.find_type(name)
mut is_ph := false mut is_ph := false