luaur_analysis/methods/
stringifier_state_emit_level.rs1use crate::records::scope::Scope;
5use crate::records::stringifier_state::StringifierState;
6use alloc::format;
7use alloc::sync::Arc;
8
9impl StringifierState {
10 pub fn emit_level(&mut self, scope: *mut Scope) {
12 unsafe {
13 let mut count: usize = 0;
14 let mut s = scope as *const Scope;
15 while !s.is_null() {
16 count += 1;
17 s = match &(*s).parent {
18 Some(p) => Arc::as_ptr(p),
19 None => core::ptr::null(),
20 };
21 }
22
23 self.emit(&count);
24
25 if luaur_common::FInt::DebugLuauVerboseTypeNames.get() >= 3 {
26 self.emit("-");
27 let v = (scope as usize as u32) & 0xFFFFFF;
29 let buffer = format!("0x{:x}", v);
30 self.emit(buffer.as_str());
31 }
32 }
33 }
34}