(state: &mut ExtractionState, node: TsNode<'_>)
| 258 | } |
| 259 | |
| 260 | fn visit_def(state: &mut ExtractionState, node: TsNode<'_>) { |
| 261 | // (def name value) |
| 262 | let Some(name) = Self::nth_sym(state, node, 1) else { |
| 263 | return; |
| 264 | }; |
| 265 | let start_line = node.start_position().row as u32; |
| 266 | let qualified_name = format!("{}::{}", state.qualified_prefix(), name); |
| 267 | let id = generate_node_id(&state.file_path, &NodeKind::Const, &name, start_line); |
| 268 | let sig = Self::first_line(state, node); |
| 269 | |
| 270 | let graph_node = Node { |
| 271 | id: id.clone(), |
| 272 | kind: NodeKind::Const, |
| 273 | name, |
| 274 | qualified_name, |
| 275 | file_path: state.file_path.clone(), |
| 276 | start_line, |
| 277 | attrs_start_line: start_line, |
| 278 | end_line: node.end_position().row as u32, |
| 279 | start_column: node.start_position().column as u32, |
| 280 | end_column: node.end_position().column as u32, |
| 281 | signature: sig, |
| 282 | docstring: None, |
| 283 | visibility: Visibility::Pub, |
| 284 | is_async: false, |
| 285 | branches: 0, |
| 286 | loops: 0, |
| 287 | returns: 0, |
| 288 | max_nesting: 0, |
| 289 | unsafe_blocks: 0, |
| 290 | unchecked_calls: 0, |
| 291 | assertions: 0, |
| 292 | updated_at: state.timestamp, |
| 293 | parent_id: None, |
| 294 | }; |
| 295 | state.nodes.push(graph_node); |
| 296 | |
| 297 | if let Some(parent_id) = state.parent_node_id() { |
| 298 | state.edges.push(Edge { |
| 299 | source: parent_id.to_string(), |
| 300 | target: id, |
| 301 | kind: EdgeKind::Contains, |
| 302 | line: Some(start_line), |
| 303 | }); |
| 304 | } |
| 305 | } |
| 306 | |
| 307 | fn visit_deftype(state: &mut ExtractionState, node: TsNode<'_>) { |
| 308 | let Some(name) = Self::nth_sym(state, node, 1) else { |
nothing calls this directly
no test coverage detected