use super::entities::{Symbol};
pub struct Context {
pub context: Vec<Symbol>,
pub func_dent: Vec<String>
}
#[allow(dead_code)]
impl Context {
pub fn create() -> Self {
Context {
context: vec![],
func_dent: Vec::new()
}
}
pub fn insert_symbol(&mut self, symbol: Symbol) {
self.context.push(symbol)
}
pub fn get(&self, name: &str) -> Option<&Symbol> {
let mut found: Option<&Symbol> = None;
self.context
.iter()
.for_each(|symbol| if symbol.symbol_name == name {
found = Some(&symbol)
});
found
}
}