luaur_analysis/methods/
state_dot_visit_child_to_dot_alt_b.rs1use crate::records::state_dot::StateDot;
2use crate::type_aliases::type_pack_id::TypePackId;
3use core::ffi::c_char;
4use luaur_common::functions::format_append::formatAppend;
5
6impl StateDot {
7 pub fn visit_child_type_pack_id_i32_c_char(
8 &mut self,
9 tp: TypePackId,
10 parent_index: i32,
11 link_name: *const c_char,
12 ) {
13 if !self.tp_to_index.contains_key(&tp) {
14 self.tp_to_index.try_insert(tp, self.next_index);
15 self.next_index += 1;
16 }
17
18 let tp_index = *self.tp_to_index.find(&tp).unwrap();
19
20 if parent_index != 0 {
21 if !link_name.is_null() {
22 let name = unsafe { core::ffi::CStr::from_ptr(link_name).to_string_lossy() };
23 formatAppend(
24 &mut self.result,
25 format_args!("n{} -> n{} [label=\"{}\"];\n", parent_index, tp_index, name),
26 );
27 } else {
28 formatAppend(
29 &mut self.result,
30 format_args!("n{} -> n{};\n", parent_index, tp_index),
31 );
32 }
33 }
34
35 self.visit_children_type_pack_id_i32(tp, tp_index);
36 }
37}