MCPcopy Index your code
hub / github.com/RustPython/RustPython / with_append

Method with_append

crates/codegen/src/symboltable.rs:419–427  ·  view source on GitHub ↗
(&mut self, x: &mut T, f: F)

Source from the content-addressed store, hash-verified

417 /// returns, the reference will be popped off the stack.
418 #[cfg(feature = "std")]
419 pub fn with_append<F, R>(&mut self, x: &mut T, f: F) -> R
420 where
421 F: FnOnce(&mut Self) -> R,
422 {
423 self.v.push(x.into());
424 let res = std::panic::catch_unwind(core::panic::AssertUnwindSafe(|| f(self)));
425 self.v.pop();
426 res.unwrap_or_else(|x| std::panic::resume_unwind(x))
427 }
428
429 /// Appends a reference to this stack for the duration of the function `f`. When `f`
430 /// returns, the reference will be popped off the stack.

Callers 1

analyze_symbol_tableMethod · 0.80

Calls 3

fFunction · 0.50
pushMethod · 0.45
popMethod · 0.45

Tested by

no test coverage detected