1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

parser: allow mutable pointer args

This commit is contained in:
Alexander Medvednikov 2020-04-26 11:53:38 +02:00
parent b495dac780
commit 0641a31fe0

View File

@ -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 {`')
}