use indexmap::IndexMap;
use mir_types::Union;
use std::sync::Arc;
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum ScopeId {
Function { file: Arc<str>, name: Arc<str> },
Method { class: Arc<str>, method: Arc<str> },
}
#[derive(Debug)]
pub struct TypeEnv {
vars: IndexMap<String, Union>,
}
impl TypeEnv {
pub(crate) fn new(vars: IndexMap<String, Union>) -> Self {
Self { vars }
}
pub fn get_var(&self, name: &str) -> Option<&Union> {
self.vars.get(name)
}
pub fn var_names(&self) -> impl Iterator<Item = &str> {
self.vars.keys().map(|s| s.as_str())
}
}