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

Method ensure_fail_pop

crates/codegen/src/compile.rs:5907–5917  ·  view source on GitHub ↗

Ensures that `pc.fail_pop` has at least `n + 1` entries. If not, new labels are generated and pushed until the required size is reached.

(&mut self, pc: &mut PatternContext, n: usize)

Source from the content-addressed store, hash-verified

5905 /// Ensures that `pc.fail_pop` has at least `n + 1` entries.
5906 /// If not, new labels are generated and pushed until the required size is reached.
5907 fn ensure_fail_pop(&mut self, pc: &mut PatternContext, n: usize) -> CompileResult<()> {
5908 let required_size = n + 1;
5909 if required_size <= pc.fail_pop.len() {
5910 return Ok(());
5911 }
5912 while pc.fail_pop.len() < required_size {
5913 let new_block = self.new_block();
5914 pc.fail_pop.push(new_block);
5915 }
5916 Ok(())
5917 }
5918
5919 fn jump_to_fail_pop(&mut self, pc: &mut PatternContext, op: JumpOp) -> CompileResult<()> {
5920 // Compute the total number of items to pop:

Callers 2

jump_to_fail_popMethod · 0.80
compile_match_innerMethod · 0.80

Calls 3

new_blockMethod · 0.80
lenMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected