parser: use single scope for fn args/body

pull/4550/head
joe-conigliaro 2020-04-22 21:15:38 +10:00
parent 80a4fbf0be
commit de182d5809
No known key found for this signature in database
GPG Key ID: C12F7136C08206F1
1 changed files with 2 additions and 2 deletions

View File

@ -208,7 +208,7 @@ fn (mut p Parser) fn_decl() ast.FnDecl {
mut stmts := []ast.Stmt mut stmts := []ast.Stmt
no_body := p.tok.kind != .lcbr no_body := p.tok.kind != .lcbr
if p.tok.kind == .lcbr { if p.tok.kind == .lcbr {
stmts = p.parse_block() stmts = p.parse_block_no_scope()
} }
p.close_scope() p.close_scope()
p.attr = '' p.attr = ''
@ -253,7 +253,7 @@ fn (mut p Parser) anon_fn() ast.AnonFn {
mut stmts := []ast.Stmt mut stmts := []ast.Stmt
no_body := p.tok.kind != .lcbr no_body := p.tok.kind != .lcbr
if p.tok.kind == .lcbr { if p.tok.kind == .lcbr {
stmts = p.parse_block() stmts = p.parse_block_no_scope()
} }
p.close_scope() p.close_scope()
func := table.Fn{ func := table.Fn{