33 lines
644 B
Rust
33 lines
644 B
Rust
use crate::vm::instruction::Instruction;
|
|
|
|
#[derive(Debug)]
|
|
pub struct DvmFunction {
|
|
fqn: String,
|
|
instructions: Vec<Instruction>,
|
|
}
|
|
|
|
impl DvmFunction {
|
|
pub fn new(fqn: &str, instructions: &[Instruction]) -> Self {
|
|
DvmFunction {
|
|
fqn: fqn.to_string(),
|
|
instructions: Vec::from(instructions),
|
|
}
|
|
}
|
|
|
|
pub fn fqn(&self) -> &str {
|
|
self.fqn.as_str()
|
|
}
|
|
|
|
pub fn instructions(&self) -> &Vec<Instruction> {
|
|
&self.instructions
|
|
}
|
|
}
|
|
|
|
impl PartialEq for DvmFunction {
|
|
fn eq(&self, other: &Self) -> bool {
|
|
self.fqn == other.fqn
|
|
}
|
|
}
|
|
|
|
impl Eq for DvmFunction {}
|