(&mut self, kind: &'static str, name: &str, node: Node<'t>, signature: Option<&str>)
| 176 | // body-extension is dead (no resolveBody hook). |
| 177 | |
| 178 | fn create_node(&mut self, kind: &'static str, name: &str, node: Node<'t>, signature: Option<&str>) -> Option<u32> { |
| 179 | if name.is_empty() { |
| 180 | return None; |
| 181 | } |
| 182 | let start_line = self.line_of(node); |
| 183 | let id = ids::node_id(self.file_path, kind, name, start_line); |
| 184 | |
| 185 | // buildQualifiedName (tree-sitter.ts:1447-1460): non-file stack names |
| 186 | // joined `::` (namespacePrefix is always empty for R). |
| 187 | let qualified = { |
| 188 | let mut parts: Vec<&str> = Vec::new(); |
| 189 | for s in &self.stack { |
| 190 | if s.kind != "file" { |
| 191 | parts.push(&s.name); |
| 192 | } |
| 193 | } |
| 194 | let mut qn = parts.join("::"); |
| 195 | if !qn.is_empty() { |
| 196 | qn.push_str("::"); |
| 197 | } |
| 198 | qn.push_str(name); |
| 199 | qn |
| 200 | }; |
| 201 | |
| 202 | let name_ref = self.arena.put(name); |
| 203 | let qn_ref = self.arena.put(&qualified); |
| 204 | let id_ref = self.arena.put(&id); |
| 205 | let sig_ref = match signature { |
| 206 | Some(s) => self.arena.put(s), |
| 207 | None => NONE_STR, |
| 208 | }; |
| 209 | let row = self.tables.push_node(&NodeRow { |
| 210 | kind: node_kind_index(kind).unwrap(), |
| 211 | visibility: 0, |
| 212 | flags: BoolFlags::default(), |
| 213 | start_line, |
| 214 | end_line: node.end_position().row as u32 + 1, |
| 215 | start_column: self.col_of(node), |
| 216 | end_column: self.end_col_of(node), |
| 217 | name: name_ref, |
| 218 | qualified_name: qn_ref, |
| 219 | id: id_ref, |
| 220 | docstring: NONE_STR, |
| 221 | signature: sig_ref, |
| 222 | decorators: NONE_STR, |
| 223 | type_parameters: NONE_STR, |
| 224 | return_type: NONE_STR, |
| 225 | extra_json: NONE_STR, |
| 226 | }); |
| 227 | |
| 228 | // Containment edge from the stack top (always non-empty — file node). |
| 229 | let parent_row = self.top_row(); |
| 230 | self.tables.push_edge(&EdgeRow { |
| 231 | source_idx: parent_row, |
| 232 | target_idx: row, |
| 233 | kind: edge_kind_index("contains").unwrap(), |
| 234 | provenance: 0, |
| 235 | line: NONE, |
no test coverage detected