(
&mut self,
p: &ast::PatternMatchSingleton,
pc: &mut PatternContext,
)
| 6745 | } |
| 6746 | |
| 6747 | fn compile_pattern_singleton( |
| 6748 | &mut self, |
| 6749 | p: &ast::PatternMatchSingleton, |
| 6750 | pc: &mut PatternContext, |
| 6751 | ) -> CompileResult<()> { |
| 6752 | // Load the singleton constant value. |
| 6753 | self.emit_load_const(match p.value { |
| 6754 | ast::Singleton::None => ConstantData::None, |
| 6755 | ast::Singleton::False => ConstantData::Boolean { value: false }, |
| 6756 | ast::Singleton::True => ConstantData::Boolean { value: true }, |
| 6757 | }); |
| 6758 | // Compare using the "Is" operator. |
| 6759 | emit!(self, Instruction::IsOp { invert: Invert::No }); |
| 6760 | // Jump to the failure label if the comparison is false. |
| 6761 | self.jump_to_fail_pop(pc, JumpOp::PopJumpIfFalse)?; |
| 6762 | Ok(()) |
| 6763 | } |
| 6764 | |
| 6765 | fn compile_pattern( |
| 6766 | &mut self, |
no test coverage detected