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

Method visit_namespace

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

Source from the content-addressed store, hash-verified

301 }
302
303 fn visit_namespace(state: &mut ExtractionState, node: TsNode<'_>) {
304 let name = Self::find_child_text(state, node, "long_identifier")
305 .or_else(|| Self::find_child_text(state, node, "identifier"))
306 .unwrap_or_else(|| "?".to_string());
307
308 let start_line = node.start_position().row as u32;
309 let qualified_name = format!("{}::{}", state.file_path, name);
310 let id = generate_node_id(&state.file_path, &NodeKind::Module, &name, start_line);
311
312 let graph_node = Node {
313 id: id.clone(),
314 kind: NodeKind::Module,
315 name: name.clone(),
316 qualified_name,
317 file_path: state.file_path.clone(),
318 start_line,
319 attrs_start_line: start_line,
320 end_line: node.end_position().row as u32,
321 start_column: 0,
322 end_column: 0,
323 signature: None,
324 docstring: None,
325 visibility: Visibility::Pub,
326 is_async: false,
327 branches: 0,
328 loops: 0,
329 returns: 0,
330 max_nesting: 0,
331 unsafe_blocks: 0,
332 unchecked_calls: 0,
333 assertions: 0,
334 updated_at: state.timestamp,
335 parent_id: None,
336 };
337 state.nodes.push(graph_node);
338
339 if let Some(parent_id) = state.parent_node_id() {
340 state.edges.push(Edge {
341 source: parent_id.to_string(),
342 target: id.clone(),
343 kind: EdgeKind::Contains,
344 line: Some(start_line),
345 });
346 }
347
348 state.node_stack.push((name, id));
349 Self::visit_children(state, node);
350 state.node_stack.pop();
351 }
352
353 fn visit_open(state: &mut ExtractionState, node: TsNode<'_>) {
354 let text = state.node_text(node);

Callers

nothing calls this directly

Calls 4

generate_node_idFunction · 0.85
visit_childrenFunction · 0.85
pushMethod · 0.80
parent_node_idMethod · 0.45

Tested by

no test coverage detected