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

Method with_recursion

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

Source from the content-addressed store, hash-verified

963 /// Grows the stack for recursive parser calls only after shallow nesting is exceeded.
964 #[inline]
965 fn with_recursion<T>(&mut self, f: impl FnOnce(&mut Self) -> T) -> T {
966 self.recursion_depth += 1;
967
968 let result = if self.recursion_depth > Self::MAX_UNCHECKED_RECURSION_DEPTH {
969 self.grow_stack(f)
970 } else {
971 f(self)
972 };
973
974 self.recursion_depth -= 1;
975 result
976 }
977
978 #[cold]
979 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