1
0
dust/dust-lang/src/instruction/load_self.rs

28 lines
613 B
Rust
Raw Normal View History

use crate::{Destination, Instruction, Operation};
2024-11-26 07:14:30 -05:00
pub struct LoadSelf {
pub destination: Destination,
2024-11-26 07:14:30 -05:00
}
impl From<&Instruction> for LoadSelf {
fn from(instruction: &Instruction) -> Self {
2024-12-08 08:01:15 -05:00
let destination = instruction.a_as_destination();
LoadSelf { destination }
2024-11-26 07:14:30 -05:00
}
}
impl From<LoadSelf> for Instruction {
fn from(load_self: LoadSelf) -> Self {
2024-12-08 08:01:15 -05:00
let (a, options) = load_self.destination.as_index_and_a_options();
2024-12-08 08:01:15 -05:00
Instruction {
operation: Operation::LOAD_SELF,
options,
a,
b: 0,
c: 0,
}
2024-11-26 07:14:30 -05:00
}
}