parser: mark var as changed only if the receiver is mutable
parent
8dd335295e
commit
b720bb2e77
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue