MCPcopy Create free account
hub / github.com/ScriptedAlchemy/tracedecay / visit_defstruct

Method visit_defstruct

src/extraction/elixir_extractor.rs:306–353  ·  view source on GitHub ↗
(state: &mut ExtractionState, node: TsNode<'_>)

Source from the content-addressed store, hash-verified

304 }
305
306 fn visit_defstruct(state: &mut ExtractionState, node: TsNode<'_>) {
307 // defstruct is a macro that defines a struct in the current module.
308 // Emit as a Class node using the enclosing module name.
309 let name = state
310 .node_stack
311 .last()
312 .map_or_else(|| "?".to_string(), |(n, _)| n.clone());
313 let start_line = node.start_position().row as u32;
314 let qualified_name = format!("{}::{}", state.qualified_prefix(), name);
315 let id = generate_node_id(&state.file_path, &NodeKind::Class, &name, start_line);
316 let sig = Self::first_line(state, node);
317
318 let graph_node = Node {
319 id: id.clone(),
320 kind: NodeKind::Class,
321 name,
322 qualified_name,
323 file_path: state.file_path.clone(),
324 start_line,
325 attrs_start_line: start_line,
326 end_line: node.end_position().row as u32,
327 start_column: node.start_position().column as u32,
328 end_column: node.end_position().column as u32,
329 signature: sig,
330 docstring: None,
331 visibility: Visibility::Pub,
332 is_async: false,
333 branches: 0,
334 loops: 0,
335 returns: 0,
336 max_nesting: 0,
337 unsafe_blocks: 0,
338 unchecked_calls: 0,
339 assertions: 0,
340 updated_at: state.timestamp,
341 parent_id: None,
342 };
343 state.nodes.push(graph_node);
344
345 if let Some(parent_id) = state.parent_node_id() {
346 state.edges.push(Edge {
347 source: parent_id.to_string(),
348 target: id,
349 kind: EdgeKind::Contains,
350 line: Some(start_line),
351 });
352 }
353 }
354
355 fn visit_use(state: &mut ExtractionState, node: TsNode<'_>) {
356 let text = state.node_text(node);

Callers

nothing calls this directly

Calls 4

generate_node_idFunction · 0.85
first_lineFunction · 0.85
pushMethod · 0.80
parent_node_idMethod · 0.45

Tested by

no test coverage detected