1
0

26 lines
666 B
Rust
Raw Normal View History

2024-11-26 07:14:30 -05:00
use crate::{Argument, Instruction, Operation};
pub struct Test {
pub argument: Argument,
2024-11-28 05:36:10 -05:00
pub test_value: bool,
2024-11-26 07:14:30 -05:00
}
impl From<&Instruction> for Test {
fn from(instruction: &Instruction) -> Self {
Test {
argument: instruction.b_as_argument(),
2024-11-28 05:36:10 -05:00
test_value: instruction.c_as_boolean(),
2024-11-26 07:14:30 -05:00
}
}
}
impl From<Test> for Instruction {
fn from(test: Test) -> Self {
*Instruction::new(Operation::Test)
.set_b(test.argument.index())
.set_b_is_constant(test.argument.is_constant())
.set_b_is_local(test.argument.is_local())
2024-11-28 05:36:10 -05:00
.set_c_to_boolean(test.test_value)
2024-11-26 07:14:30 -05:00
}
}