From 0641a31fe065f6c33bdcf54f6c9659ee92fb8f44 Mon Sep 17 00:00:00 2001 From: Alexander Medvednikov Date: Sun, 26 Apr 2020 11:53:38 +0200 Subject: [PATCH] parser: allow mutable pointer args --- vlib/v/parser/fn.v | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vlib/v/parser/fn.v b/vlib/v/parser/fn.v index c4b9b8f29a..d35c29a906 100644 --- a/vlib/v/parser/fn.v +++ b/vlib/v/parser/fn.v @@ -170,7 +170,7 @@ fn (mut p Parser) fn_decl() ast.FnDecl { continue } sym := p.table.get_type_symbol(arg.typ) - if sym.kind !in [.array, .struct_, .map, .placeholder] { + if sym.kind !in [.array, .struct_, .map, .placeholder] && !arg.typ.is_ptr() { p.error('mutable arguments are only allowed for arrays, maps, and structs\n' + 'return values instead: `fn foo(n mut int) {` => `fn foo(n int) int {`') }