33 lines
700 B
Rust
33 lines
700 B
Rust
use crate::vm::function::DvmFunction;
|
|
use crate::vm::virtual_method::DmVirtualMethod;
|
|
use std::rc::Rc;
|
|
|
|
#[derive(Debug, Eq)]
|
|
pub struct DvmMethod {
|
|
function: Rc<DvmFunction>,
|
|
implements: Option<Rc<DmVirtualMethod>>,
|
|
}
|
|
|
|
impl PartialEq for DvmMethod {
|
|
fn eq(&self, other: &Self) -> bool {
|
|
self.function == other.function
|
|
}
|
|
}
|
|
|
|
impl DvmMethod {
|
|
pub fn new(dm_fn: DvmFunction, implements: Option<Rc<DmVirtualMethod>>) -> Self {
|
|
DvmMethod {
|
|
function: Rc::new(dm_fn),
|
|
implements,
|
|
}
|
|
}
|
|
|
|
pub fn fqn(&self) -> &str {
|
|
self.function.fqn()
|
|
}
|
|
|
|
pub fn dm_fn(&self) -> Rc<DvmFunction> {
|
|
self.function.clone()
|
|
}
|
|
}
|