mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-29 20:34:44 +00:00
Forbid accessing to a mut object in a func
This commit is contained in:
parent
9b1457b695
commit
afad52c449
3 changed files with 35 additions and 0 deletions
|
@ -374,6 +374,16 @@ impl SideEffectChecker {
|
|||
Expr::TypeAsc(type_asc) => {
|
||||
self.check_expr(&type_asc.expr);
|
||||
}
|
||||
Expr::Accessor(acc) => {
|
||||
if !self.in_context_effects_allowed() && acc.ref_t().is_mut_type() {
|
||||
self.errs.push(EffectError::touch_mut_error(
|
||||
self.cfg.input.clone(),
|
||||
line!() as usize,
|
||||
expr,
|
||||
self.full_path(),
|
||||
));
|
||||
}
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue