share comparisonop between bytecode and vm

This commit is contained in:
Jeong Yunwon 2022-05-12 03:59:57 +09:00
parent f721781499
commit be43bfaa80

View file

@ -1469,22 +1469,22 @@ impl Compiler {
let compile_cmpop = |op: &ast::Cmpop| match op { let compile_cmpop = |op: &ast::Cmpop| match op {
ast::Cmpop::Eq => Instruction::CompareOperation { ast::Cmpop::Eq => Instruction::CompareOperation {
op: bytecode::CompareOperator::Equal, op: bytecode::ComparisonOperator::Equal,
}, },
ast::Cmpop::NotEq => Instruction::CompareOperation { ast::Cmpop::NotEq => Instruction::CompareOperation {
op: bytecode::CompareOperator::NotEqual, op: bytecode::ComparisonOperator::NotEqual,
}, },
ast::Cmpop::Lt => Instruction::CompareOperation { ast::Cmpop::Lt => Instruction::CompareOperation {
op: bytecode::CompareOperator::Less, op: bytecode::ComparisonOperator::Less,
}, },
ast::Cmpop::LtE => Instruction::CompareOperation { ast::Cmpop::LtE => Instruction::CompareOperation {
op: bytecode::CompareOperator::LessOrEqual, op: bytecode::ComparisonOperator::LessOrEqual,
}, },
ast::Cmpop::Gt => Instruction::CompareOperation { ast::Cmpop::Gt => Instruction::CompareOperation {
op: bytecode::CompareOperator::Greater, op: bytecode::ComparisonOperator::Greater,
}, },
ast::Cmpop::GtE => Instruction::CompareOperation { ast::Cmpop::GtE => Instruction::CompareOperation {
op: bytecode::CompareOperator::GreaterOrEqual, op: bytecode::ComparisonOperator::GreaterOrEqual,
}, },
ast::Cmpop::In => Instruction::TestOperation { ast::Cmpop::In => Instruction::TestOperation {
op: bytecode::TestOperator::In, op: bytecode::TestOperator::In,