(&self, name: InternedString<'gc>)
| 224 | } |
| 225 | |
| 226 | pub fn get_global(&self, name: InternedString<'gc>) -> Option<Value<'gc>> { |
| 227 | // First check if it's a module name |
| 228 | if let Some(module) = self.module_manager.get_module(name) { |
| 229 | return Some(Value::Module(module.name())); |
| 230 | } |
| 231 | |
| 232 | // Then check current globals scope |
| 233 | if let Some(value) = self.globals.get(&name).copied() { |
| 234 | return Some(value); |
| 235 | } |
| 236 | |
| 237 | // Finally check current module's globals if we're in a module |
| 238 | if let Some(current_module) = self.current_module { |
| 239 | if let Some(ModuleKind::Script { globals, .. }) = |
| 240 | self.module_manager.modules.get(¤t_module) |
| 241 | { |
| 242 | if let Some(value) = globals.get(&name).copied() { |
| 243 | return Some(value); |
| 244 | } |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | None |
| 249 | } |
| 250 | |
| 251 | pub fn gc_ref<T: Collect>(&mut self, value: T) -> GcRefLock<'gc, T> { |
| 252 | Gc::new(self.mc, RefLock::new(value)) |
no test coverage detected