(&mut self, kind: &'static str, name: &str, node: Node<'t>, extra: Extra)
| 295 | // --- createNode (tree-sitter.ts:1308) --------------------------------- |
| 296 | |
| 297 | fn create_node(&mut self, kind: &'static str, name: &str, node: Node<'t>, extra: Extra) -> Option<u32> { |
| 298 | if name.is_empty() { |
| 299 | return None; |
| 300 | } |
| 301 | let start_line = self.line_of(node); |
| 302 | let column = self.col_of(node); |
| 303 | let id = self.node_id_allocator.generate(self.file_path, kind, name, start_line, column); |
| 304 | |
| 305 | // buildQualifiedName (:1447-1460) — non-file stack names, `::`-joined; |
| 306 | // namespacePrefix always empty (no C++ namespaces, no scala namespace). |
| 307 | let qualified = { |
| 308 | let mut parts: Vec<&str> = Vec::new(); |
| 309 | for s in &self.stack { |
| 310 | if s.kind != "file" { |
| 311 | parts.push(&s.name); |
| 312 | } |
| 313 | } |
| 314 | let mut qn = parts.join("::"); |
| 315 | if !qn.is_empty() { |
| 316 | qn.push_str("::"); |
| 317 | } |
| 318 | qn.push_str(name); |
| 319 | qn |
| 320 | }; |
| 321 | |
| 322 | let name_ref = self.arena.put(name); |
| 323 | let qn_ref = self.arena.put(&qualified); |
| 324 | let id_ref = self.arena.put(&id); |
| 325 | let doc_ref = opt_str(&mut self.arena, extra.docstring.as_deref()); |
| 326 | let sig_ref = opt_str(&mut self.arena, extra.signature.as_deref()); |
| 327 | let ret_ref = opt_str(&mut self.arena, extra.return_type.as_deref()); |
| 328 | let mut flags = BoolFlags::default(); |
| 329 | if let Some(v) = extra.is_async { |
| 330 | flags.set(FLAG_IS_ASYNC, v); |
| 331 | } |
| 332 | if let Some(v) = extra.is_static { |
| 333 | flags.set(FLAG_IS_STATIC, v); |
| 334 | } |
| 335 | let row = self.tables.push_node(&NodeRow { |
| 336 | kind: node_kind_index(kind).unwrap(), |
| 337 | visibility: extra.visibility, |
| 338 | flags, |
| 339 | start_line, |
| 340 | end_line: node.end_position().row as u32 + 1, // no resolveBody hook |
| 341 | start_column: self.col_of(node), |
| 342 | end_column: self.end_col_of(node), |
| 343 | name: name_ref, |
| 344 | qualified_name: qn_ref, |
| 345 | id: id_ref, |
| 346 | docstring: doc_ref, |
| 347 | signature: sig_ref, |
| 348 | decorators: NONE_STR, |
| 349 | type_parameters: NONE_STR, |
| 350 | return_type: ret_ref, |
| 351 | extra_json: NONE_STR, |
| 352 | }); |
| 353 | self.node_ids.push(id.clone()); |
| 354 | if kind == "function" || kind == "method" { |
no test coverage detected