Returns the bytecode opcode constructor for `relop` and operands of type `etype`.
(
relop: &CaseRelOp,
etype: ExprType,
)
| 237 | |
| 238 | /// Returns the bytecode opcode constructor for `relop` and operands of type `etype`. |
| 239 | fn case_relop_instr( |
| 240 | relop: &CaseRelOp, |
| 241 | etype: ExprType, |
| 242 | ) -> Option<fn(Register, Register, Register) -> u32> { |
| 243 | match etype { |
| 244 | ExprType::Boolean => match relop { |
| 245 | CaseRelOp::Equal => Some(bytecode::make_equal_boolean), |
| 246 | CaseRelOp::NotEqual => Some(bytecode::make_not_equal_boolean), |
| 247 | CaseRelOp::Less |
| 248 | | CaseRelOp::LessEqual |
| 249 | | CaseRelOp::Greater |
| 250 | | CaseRelOp::GreaterEqual => None, |
| 251 | }, |
| 252 | |
| 253 | ExprType::Double => match relop { |
| 254 | CaseRelOp::Equal => Some(bytecode::make_equal_double), |
| 255 | CaseRelOp::NotEqual => Some(bytecode::make_not_equal_double), |
| 256 | CaseRelOp::Less => Some(bytecode::make_less_double), |
| 257 | CaseRelOp::LessEqual => Some(bytecode::make_less_equal_double), |
| 258 | CaseRelOp::Greater => Some(bytecode::make_greater_double), |
| 259 | CaseRelOp::GreaterEqual => Some(bytecode::make_greater_equal_double), |
| 260 | }, |
| 261 | |
| 262 | ExprType::Integer => match relop { |
| 263 | CaseRelOp::Equal => Some(bytecode::make_equal_integer), |
| 264 | CaseRelOp::NotEqual => Some(bytecode::make_not_equal_integer), |
| 265 | CaseRelOp::Less => Some(bytecode::make_less_integer), |
| 266 | CaseRelOp::LessEqual => Some(bytecode::make_less_equal_integer), |
| 267 | CaseRelOp::Greater => Some(bytecode::make_greater_integer), |
| 268 | CaseRelOp::GreaterEqual => Some(bytecode::make_greater_equal_integer), |
| 269 | }, |
| 270 | |
| 271 | ExprType::Text => match relop { |
| 272 | CaseRelOp::Equal => Some(bytecode::make_equal_text), |
| 273 | CaseRelOp::NotEqual => Some(bytecode::make_not_equal_text), |
| 274 | CaseRelOp::Less => Some(bytecode::make_less_text), |
| 275 | CaseRelOp::LessEqual => Some(bytecode::make_less_equal_text), |
| 276 | CaseRelOp::Greater => Some(bytecode::make_greater_text), |
| 277 | CaseRelOp::GreaterEqual => Some(bytecode::make_greater_equal_text), |
| 278 | }, |
| 279 | } |
| 280 | } |
| 281 | |
| 282 | /// Compiles a comparison between `test` and `rhs`, leaving the boolean result in `dest`. |
| 283 | fn compile_case_relop( |
no outgoing calls
no test coverage detected