(state: &mut ExtractionState, node: TsNode<'_>)
| 152 | } |
| 153 | |
| 154 | fn visit_defmodule(state: &mut ExtractionState, node: TsNode<'_>) { |
| 155 | // defmodule MyModule do ... end |
| 156 | let name = Self::call_arg_name(state, node).unwrap_or_else(|| "?".to_string()); |
| 157 | let start_line = node.start_position().row as u32; |
| 158 | let qualified_name = format!("{}::{}", state.qualified_prefix(), name); |
| 159 | let id = generate_node_id(&state.file_path, &NodeKind::Module, &name, start_line); |
| 160 | |
| 161 | let graph_node = Node { |
| 162 | id: id.clone(), |
| 163 | kind: NodeKind::Module, |
| 164 | name: name.clone(), |
| 165 | qualified_name, |
| 166 | file_path: state.file_path.clone(), |
| 167 | start_line, |
| 168 | attrs_start_line: start_line, |
| 169 | end_line: node.end_position().row as u32, |
| 170 | start_column: node.start_position().column as u32, |
| 171 | end_column: node.end_position().column as u32, |
| 172 | signature: None, |
| 173 | docstring: None, |
| 174 | visibility: Visibility::Pub, |
| 175 | is_async: false, |
| 176 | branches: 0, |
| 177 | loops: 0, |
| 178 | returns: 0, |
| 179 | max_nesting: 0, |
| 180 | unsafe_blocks: 0, |
| 181 | unchecked_calls: 0, |
| 182 | assertions: 0, |
| 183 | updated_at: state.timestamp, |
| 184 | parent_id: None, |
| 185 | }; |
| 186 | state.nodes.push(graph_node); |
| 187 | |
| 188 | if let Some(parent_id) = state.parent_node_id() { |
| 189 | state.edges.push(Edge { |
| 190 | source: parent_id.to_string(), |
| 191 | target: id.clone(), |
| 192 | kind: EdgeKind::Contains, |
| 193 | line: Some(start_line), |
| 194 | }); |
| 195 | } |
| 196 | |
| 197 | state.node_stack.push((name, id)); |
| 198 | // Recurse into the do_block body. |
| 199 | if let Some(body) = Self::find_do_block(node) { |
| 200 | Self::visit_children(state, body); |
| 201 | } |
| 202 | state.node_stack.pop(); |
| 203 | } |
| 204 | |
| 205 | fn visit_def(state: &mut ExtractionState, node: TsNode<'_>, is_private: bool) { |
| 206 | // def name(args) do ... end |
nothing calls this directly
no test coverage detected