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

Method compile_pattern_value

crates/codegen/src/compile.rs:6729–6745  ·  view source on GitHub ↗
(
        &mut self,
        p: &ast::PatternMatchValue,
        pc: &mut PatternContext,
    )

Source from the content-addressed store, hash-verified

6727 }
6728
6729 fn compile_pattern_value(
6730 &mut self,
6731 p: &ast::PatternMatchValue,
6732 pc: &mut PatternContext,
6733 ) -> CompileResult<()> {
6734 // TODO: ensure literal or attribute lookup
6735 self.compile_expression(&p.value)?;
6736 emit!(
6737 self,
6738 Instruction::CompareOp {
6739 opname: bytecode::ComparisonOperator::Equal
6740 }
6741 );
6742 // emit!(self, Instruction::ToBool);
6743 self.jump_to_fail_pop(pc, JumpOp::PopJumpIfFalse)?;
6744 Ok(())
6745 }
6746
6747 fn compile_pattern_singleton(
6748 &mut self,

Callers 1

compile_patternMethod · 0.80

Calls 2

compile_expressionMethod · 0.80
jump_to_fail_popMethod · 0.80

Tested by

no test coverage detected