Skip to main content

luaur_analysis/functions/
dump_bindings.rs

1use crate::functions::to_string_to_string_alt_m::to_string_type_id_to_string_options;
2use crate::records::scope::Scope;
3use crate::records::to_string_options::ToStringOptions;
4use alloc::string::String;
5
6/// C++ `static void dumpBindings(NotNull<Scope> scope, ToStringOptions& opts)`.
7pub fn dump_bindings(scope: *mut Scope, opts: &mut ToStringOptions) {
8    let scope_ref = unsafe { &*scope };
9
10    for (k, v) in &scope_ref.bindings {
11        let d: String = to_string_type_id_to_string_options(v.type_id, opts);
12        let key_str = unsafe { core::ffi::CStr::from_ptr(k.c_str()).to_string_lossy() };
13        println!("\t{} : {}", key_str, d);
14    }
15
16    for child in &scope_ref.children {
17        dump_bindings(*child, opts);
18    }
19}