luaur_analysis/functions/
to_string_symbol.rs1extern crate alloc;
4
5use crate::records::symbol::Symbol;
6use alloc::string::String;
7use luaur_common::macros::luau_assert::LUAU_ASSERT;
8
9pub unsafe fn to_string(name: &Symbol) -> String {
11 if !name.local.is_null() {
12 return core::ffi::CStr::from_ptr((*name.local).name.value)
13 .to_string_lossy()
14 .into_owned();
15 }
16
17 LUAU_ASSERT!(!name.global.value.is_null());
18 core::ffi::CStr::from_ptr(name.global.value)
19 .to_string_lossy()
20 .into_owned()
21}
22
23#[allow(unused_imports)]
24pub use to_string as to_string_symbol;