1use indexmap::IndexMap;
3use mir_types::Union;
4use std::sync::Arc;
5
6#[derive(Debug, Clone, PartialEq, Eq, Hash)]
8pub enum ScopeId {
9 Function { file: Arc<str>, name: Arc<str> },
10 Method { class: Arc<str>, method: Arc<str> },
11}
12
13#[allow(dead_code)]
15#[derive(Debug)]
16pub struct TypeEnv {
17 #[allow(dead_code)]
18 vars: IndexMap<String, Union>,
19}
20
21impl TypeEnv {
22 pub(crate) fn new(vars: IndexMap<String, Union>) -> Self {
23 Self { vars }
24 }
25
26 #[allow(dead_code)]
28 pub fn get_var(&self, name: &str) -> Option<&Union> {
29 self.vars.get(name)
30 }
31
32 #[allow(dead_code)]
34 pub fn var_names(&self) -> impl Iterator<Item = &str> {
35 self.vars.keys().map(|s| s.as_str())
36 }
37}