mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 10:49:54 +00:00
fix: relax side effect check
This commit is contained in:
parent
29e49616b9
commit
5365c87cb4
5 changed files with 68 additions and 1 deletions
|
@ -694,6 +694,22 @@ impl Accessor {
|
|||
Self::Attr(attr) => &attr.ident.raw.name,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn obj(&self) -> Option<&Expr> {
|
||||
match self {
|
||||
Self::Attr(attr) => Some(&attr.obj),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn root_obj(&self) -> Option<&Expr> {
|
||||
match self.obj() {
|
||||
Some(expr @ Expr::Accessor(Accessor::Ident(_))) => Some(expr),
|
||||
Some(Expr::Accessor(acc)) => acc.root_obj(),
|
||||
Some(obj) => Some(obj),
|
||||
None => None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue