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

Method visit_ns

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

Source from the content-addressed store, hash-verified

152 }
153
154 fn visit_ns(state: &mut ExtractionState, node: TsNode<'_>) {
155 // (ns my.namespace ...)
156 let Some(name) = Self::nth_sym(state, node, 1) else {
157 return;
158 };
159 let start_line = node.start_position().row as u32;
160 let qualified_name = format!("{}::{}", state.file_path, name);
161 let id = generate_node_id(&state.file_path, &NodeKind::Module, &name, start_line);
162
163 let graph_node = Node {
164 id: id.clone(),
165 kind: NodeKind::Module,
166 name: name.clone(),
167 qualified_name,
168 file_path: state.file_path.clone(),
169 start_line,
170 attrs_start_line: start_line,
171 end_line: node.end_position().row as u32,
172 start_column: node.start_position().column as u32,
173 end_column: node.end_position().column as u32,
174 signature: None,
175 docstring: None,
176 visibility: Visibility::Pub,
177 is_async: false,
178 branches: 0,
179 loops: 0,
180 returns: 0,
181 max_nesting: 0,
182 unsafe_blocks: 0,
183 unchecked_calls: 0,
184 assertions: 0,
185 updated_at: state.timestamp,
186 parent_id: None,
187 };
188 state.nodes.push(graph_node);
189
190 if let Some(parent_id) = state.parent_node_id() {
191 state.edges.push(Edge {
192 source: parent_id.to_string(),
193 target: id.clone(),
194 kind: EdgeKind::Contains,
195 line: Some(start_line),
196 });
197 }
198
199 state.node_stack.push((name, id));
200 Self::visit_children(state, node);
201 state.node_stack.pop();
202 }
203
204 fn visit_defn(state: &mut ExtractionState, node: TsNode<'_>, is_macro: bool) {
205 // (defn name [args] "docstring" body)

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