41 lines
1.1 KiB
Rust
41 lines
1.1 KiB
Rust
use crate::symbol::generic_parameter_symbol::GenericParameterSymbol;
|
|
use std::collections::HashMap;
|
|
use std::fmt::{Debug, Formatter};
|
|
use std::rc::Rc;
|
|
|
|
pub struct ClassScope {
|
|
debug_name: String,
|
|
parent_id: usize,
|
|
generic_parameter_symbols: HashMap<Rc<str>, Rc<GenericParameterSymbol>>,
|
|
}
|
|
|
|
impl ClassScope {
|
|
pub fn new(debug_name: &str, parent_id: usize) -> Self {
|
|
Self {
|
|
debug_name: debug_name.into(),
|
|
parent_id,
|
|
generic_parameter_symbols: HashMap::new(),
|
|
}
|
|
}
|
|
|
|
pub fn parent_id(&self) -> usize {
|
|
self.parent_id
|
|
}
|
|
|
|
pub fn generic_parameter_symbols(&self) -> &HashMap<Rc<str>, Rc<GenericParameterSymbol>> {
|
|
&self.generic_parameter_symbols
|
|
}
|
|
|
|
pub fn generic_parameter_symbols_mut(
|
|
&mut self,
|
|
) -> &mut HashMap<Rc<str>, Rc<GenericParameterSymbol>> {
|
|
&mut self.generic_parameter_symbols
|
|
}
|
|
}
|
|
|
|
impl Debug for ClassScope {
|
|
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
|
|
write!(f, "ClassScope({}, {})", self.debug_name, self.parent_id)
|
|
}
|
|
}
|