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

Method switch_to_block

crates/codegen/src/compile.rs:9881–9898  ·  view source on GitHub ↗
(&mut self, block: BlockIdx)

Source from the content-addressed store, hash-verified

9879 }
9880
9881 fn switch_to_block(&mut self, block: BlockIdx) {
9882 let code = self.current_code_info();
9883 let prev = code.current_block;
9884 assert_ne!(prev, block, "recursive switching {prev:?} -> {block:?}");
9885 assert_eq!(
9886 code.blocks[block].next,
9887 BlockIdx::NULL,
9888 "switching {prev:?} -> {block:?} to completed block"
9889 );
9890 let prev_block = &mut code.blocks[prev.idx()];
9891 assert_eq!(
9892 u32::from(prev_block.next),
9893 u32::MAX,
9894 "switching {prev:?} -> {block:?} from block that's already got a next"
9895 );
9896 prev_block.next = block;
9897 code.current_block = block;
9898 }
9899
9900 const fn set_source_range(&mut self, range: TextRange) {
9901 self.current_source_range = range;

Callers 15

build_functionMethod · 0.80
compileMethod · 0.80
add_instructionMethod · 0.80
compile_fpowMethod · 0.80
compile_ipowMethod · 0.80
compile_statementMethod · 0.80
compile_try_statementMethod · 0.80
compile_function_bodyMethod · 0.80

Calls 2

current_code_infoMethod · 0.80
idxMethod · 0.80

Tested by

no test coverage detected