From 02ea168f71824ae0f7f821b4473cc95c68a24d7d Mon Sep 17 00:00:00 2001 From: Stefanos Baziotis Date: Sat, 10 Aug 2019 14:08:59 +0300 Subject: [PATCH] Fix deprecated error --- compiler/parser.v | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/compiler/parser.v b/compiler/parser.v index eadf0cd039..94a6dfef87 100644 --- a/compiler/parser.v +++ b/compiler/parser.v @@ -458,6 +458,10 @@ fn (p mut Parser) const_decl() { fn (p mut Parser) type_decl() { p.check(.key_type) 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() nt_pair := p.table.cgen_name_type_pair(name, parent) // TODO dirty C typedef hacks for DOOM @@ -544,10 +548,6 @@ fn (p mut Parser) struct_decl() { 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 mut typ := p.table.find_type(name) mut is_ph := false