From 8c4429c875aebe51fdc8e241ecdc6b3712900b04 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 24 Jul 2020 11:27:56 +0300 Subject: [PATCH] parser: fix passing the is_mut flag of anon fn arguments --- vlib/v/parser/fn.v | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/vlib/v/parser/fn.v b/vlib/v/parser/fn.v index 0c63dab250..092dffac4e 100644 --- a/vlib/v/parser/fn.v +++ b/vlib/v/parser/fn.v @@ -194,6 +194,7 @@ fn (mut p Parser) fn_decl() ast.FnDecl { rec_type = rec_type.set_flag(.atomic_f) } args << table.Arg{ + pos: rec_start_pos name: rec_name is_mut: rec_mut typ: rec_type @@ -235,7 +236,7 @@ fn (mut p Parser) fn_decl() ast.FnDecl { name: arg.name typ: arg.typ is_mut: arg.is_mut - pos: p.tok.position() + pos: arg.pos is_used: true is_arg: true }) @@ -341,7 +342,8 @@ fn (mut p Parser) anon_fn() ast.AnonFn { p.scope.register(arg.name, ast.Var{ name: arg.name typ: arg.typ - pos: p.tok.position() + is_mut: arg.is_mut + pos: arg.pos is_used: true is_arg: true })