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

parser: mark var as changed only if the receiver is mutable

This commit is contained in:
Alexander Medvednikov 2019-11-06 06:48:57 +03:00
parent 8dd335295e
commit b720bb2e77

View File

@ -727,7 +727,7 @@ fn (p mut Parser) fn_call(f mut Fn, method_ph int, receiver_var, receiver_type s
p.error('`$p.expr_var.name` is immutable, declare it with `mut`')
}
}
if !p.expr_var.is_changed {
if !p.expr_var.is_changed && receiver.is_mut {
p.mark_var_changed(p.expr_var)
}
p.gen_method_call(receiver, receiver_type, cgen_name, f.typ, method_ph)