mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 07:04:29 +00:00
Use Iterator::count() to check function stack depth
This commit is contained in:
parent
b495cffa50
commit
f6200224fc
1 changed files with 6 additions and 5 deletions
|
@ -1059,11 +1059,12 @@ impl Parser {
|
|||
return false;
|
||||
}
|
||||
// Count the functions.
|
||||
let mut depth = 0;
|
||||
let blocks = self.blocks();
|
||||
for b in blocks.iter().rev() {
|
||||
depth += if b.is_function_call() { 1 } else { 0 };
|
||||
}
|
||||
let depth = self
|
||||
.blocks()
|
||||
.iter()
|
||||
.rev()
|
||||
.filter(|b| b.is_function_call())
|
||||
.count();
|
||||
depth > FISH_MAX_STACK_DEPTH
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue