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

pull/2663/head
Alexander Medvednikov 2019-11-06 06:48:57 +03:00
parent 8dd335295e
commit b720bb2e77
1 changed files with 1 additions and 1 deletions

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)