mirror of
https://github.com/erg-lang/erg.git
synced 2025-08-04 18:58:30 +00:00
fix: avoid infinite recursion bugs
This commit is contained in:
parent
2a0998f0cd
commit
b318395a32
10 changed files with 128 additions and 48 deletions
|
@ -22,6 +22,7 @@ impl ModuleGraph {
|
|||
}
|
||||
|
||||
pub fn get_node(&self, path: &Path) -> Option<&Node<PathBuf, ()>> {
|
||||
let path = normalize_path(path.to_path_buf());
|
||||
self.0.iter().find(|n| n.id == path)
|
||||
}
|
||||
|
||||
|
@ -34,6 +35,7 @@ impl ModuleGraph {
|
|||
}
|
||||
|
||||
pub fn inc_ref(&mut self, referrer: &Path, depends_on: PathBuf) {
|
||||
let referrer = normalize_path(referrer.to_path_buf());
|
||||
let depends_on = normalize_path(depends_on);
|
||||
if let Some(node) = self.0.iter_mut().find(|n| n.id == referrer) {
|
||||
if referrer == depends_on {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue