MCPcopy Create free account
hub / github.com/astral-sh/ruff / with_recursion

Method with_recursion

crates/ruff_python_parser/src/parser/mod.rs:164–175  ·  view source on GitHub ↗
(&mut self, f: impl FnOnce(&mut Self) -> T)

Source from the content-addressed store, hash-verified

162 /// Grows the stack for recursive parser calls only after shallow nesting is exceeded.
163 #[inline]
164 fn with_recursion<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T {
165 self.recursion_depth += 1;
166
167 let result = if self.recursion_depth > MAX_UNCHECKED_RECURSION_DEPTH {
168 self.grow_stack(f)
169 } else {
170 f(self)
171 };
172
173 self.recursion_depth -= 1;
174 result
175 }
176
177 #[cold]
178 fn grow_stack<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T {

Callers 7

parse_lambda_exprMethod · 0.80
parse_if_expressionMethod · 0.80
parse_async_statementMethod · 0.80
parse_blockMethod · 0.80

Calls 2

grow_stackMethod · 0.80
fFunction · 0.50

Tested by

no test coverage detected