use super::super::*;
use crate::slice_file::Span;
use crate::utils::ptr_util::WeakPtr;
#[derive(Debug)]
pub struct Module {
pub identifier: Identifier,
pub attributes: Vec<WeakPtr<Attribute>>,
pub span: Span,
}
impl Module {
pub fn nested_module_identifier(&self) -> &str {
&self.identifier.value
}
}
impl NamedSymbol for Module {
fn identifier(&self) -> &str {
if let Some(last_colon_index) = self.identifier.value.rfind(':') {
&self.identifier.value[last_colon_index + 1..]
} else {
&self.identifier.value
}
}
fn raw_identifier(&self) -> &Identifier {
&self.identifier
}
fn module_scoped_identifier(&self) -> String {
self.nested_module_identifier().to_owned()
}
fn parser_scoped_identifier(&self) -> String {
self.nested_module_identifier().to_owned()
}
}
implement_Element_for!(Module, "module");
implement_Symbol_for!(Module);
implement_Attributable_for!(Module);