Skip to content

Commit

Permalink
refactor: break down is_shadowing_prev_scope to separate lines
Browse files Browse the repository at this point in the history
  • Loading branch information
Ph0enixKM committed Dec 11, 2024
1 parent 49043e1 commit 4377b57
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/utils/metadata/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,15 @@ impl ParserMetadata {
}

pub fn is_shadowing_prev_scope(&self, name: &str) -> bool {
self.context.scopes.len() > 1
&& self.context.scopes.iter().rev().skip(1)
.find_map(|scope| scope.get_var(name)).is_some()
if self.context.scopes.len() > 1 {
self.context.scopes.iter()
.rev()
.skip(1)
.find_map(|scope| scope.get_var(name))
.is_some()
} else {
false
}
}

/// Gets a variable from the current scope or any parent scope
Expand Down

0 comments on commit 4377b57

Please sign in to comment.