luaur_analysis/methods/
frontend_add_environment.rs1use crate::records::frontend::Frontend;
2use crate::type_aliases::scope_ptr_type::ScopePtr;
3use alloc::string::String;
4
5impl Frontend {
6 pub fn add_environment(&mut self, environment_name: String) -> ScopePtr {
7 if let Some(scope) = self.environments.get(&environment_name) {
8 return scope.clone();
9 }
10 let scope = ScopePtr::new(crate::records::scope::Scope::new(
11 &self.globals.global_scope,
12 0,
13 ));
14 self.environments.insert(environment_name, scope.clone());
15 scope
16 }
17}