cgen: add `new` to reserved words

pull/4733/head
Alexander Medvednikov 2020-05-05 16:50:59 +02:00
parent ddb5a8e6e4
commit ff88906e9a
1 changed files with 4 additions and 5 deletions

View File

@ -36,7 +36,8 @@ const (
'unsigned', 'unsigned',
'void', 'void',
'volatile', 'volatile',
'while' 'while',
'new'
] ]
) )
@ -1926,11 +1927,9 @@ fn (mut g Gen) return_statement(node ast.Return) {
return return
} }
fn_return_is_optional := g.fn_decl.return_type.flag_is(.optional) fn_return_is_optional := g.fn_decl.return_type.flag_is(.optional)
// got to do a correct check for multireturn // got to do a correct check for multireturn
sym := g.table.get_type_symbol(g.fn_decl.return_type) sym := g.table.get_type_symbol(g.fn_decl.return_type)
fn_return_is_multi := sym.kind == .multi_return fn_return_is_multi := sym.kind == .multi_return
// optional multi not supported // optional multi not supported
if fn_return_is_multi && !fn_return_is_optional { if fn_return_is_multi && !fn_return_is_optional {
g.write(' ') g.write(' ')