(&mut self, kind: &'static str, name: &str, node: Node<'t>, extra: Extra)
| 199 | // --- createNode (tree-sitter.ts:1308) --------------------------------- |
| 200 | |
| 201 | fn create_node(&mut self, kind: &'static str, name: &str, node: Node<'t>, extra: Extra) -> Option<u32> { |
| 202 | if name.is_empty() { |
| 203 | return None; |
| 204 | } |
| 205 | let start_line = self.line_of(node); |
| 206 | let id = ids::node_id(self.file_path, kind, name, start_line); |
| 207 | |
| 208 | // buildQualifiedName (1447-1460) — non-file stack NAMES joined `::`; |
| 209 | // the receiver override (extractMethod:1790-1792) replaces it whole. |
| 210 | let qualified = match &extra.qualified_name_override { |
| 211 | Some(qn) => qn.clone(), |
| 212 | None => { |
| 213 | let mut parts: Vec<&str> = Vec::new(); |
| 214 | for s in &self.stack { |
| 215 | if s.kind != "file" { |
| 216 | parts.push(&s.name); |
| 217 | } |
| 218 | } |
| 219 | let mut qn = parts.join("::"); |
| 220 | if !qn.is_empty() { |
| 221 | qn.push_str("::"); |
| 222 | } |
| 223 | qn.push_str(name); |
| 224 | qn |
| 225 | } |
| 226 | }; |
| 227 | |
| 228 | let name_ref = self.arena.put(name); |
| 229 | let qn_ref = self.arena.put(&qualified); |
| 230 | let id_ref = self.arena.put(&id); |
| 231 | let doc_ref = opt_str(&mut self.arena, extra.docstring.as_deref()); |
| 232 | let sig_ref = opt_str(&mut self.arena, extra.signature.as_deref()); |
| 233 | let mut flags = BoolFlags::default(); |
| 234 | if let Some(v) = extra.is_exported { |
| 235 | flags.set(FLAG_IS_EXPORTED, v); |
| 236 | } |
| 237 | let row = self.tables.push_node(&NodeRow { |
| 238 | kind: node_kind_index(kind).unwrap(), |
| 239 | visibility: 0, |
| 240 | flags, |
| 241 | start_line, |
| 242 | end_line: node.end_position().row as u32 + 1, // no resolveBody |
| 243 | start_column: self.col_of(node), |
| 244 | end_column: self.end_col_of(node), |
| 245 | name: name_ref, |
| 246 | qualified_name: qn_ref, |
| 247 | id: id_ref, |
| 248 | docstring: doc_ref, |
| 249 | signature: sig_ref, |
| 250 | decorators: NONE_STR, |
| 251 | type_parameters: NONE_STR, |
| 252 | return_type: NONE_STR, |
| 253 | extra_json: NONE_STR, |
| 254 | }); |
| 255 | self.node_ids.push(id); |
| 256 | if kind == "function" || kind == "method" { |
| 257 | self.defined_fn_names.insert(name.to_string()); |
| 258 | } |
no test coverage detected