(&mut self, kind: &'static str, name: &str, node: Node<'t>, extra: Extra)
| 348 | // --- createNode (tree-sitter.ts:1308) --------------------------------- |
| 349 | |
| 350 | fn create_node(&mut self, kind: &'static str, name: &str, node: Node<'t>, extra: Extra) -> Option<u32> { |
| 351 | if name.is_empty() { |
| 352 | return None; |
| 353 | } |
| 354 | let start_line = self.line_of(node); |
| 355 | let column = self.col_of(node); |
| 356 | let id = self.node_id_allocator.generate(self.file_path, kind, name, start_line, column); |
| 357 | |
| 358 | let qualified = { |
| 359 | let mut parts: Vec<&str> = Vec::new(); |
| 360 | for s in &self.stack { |
| 361 | if s.kind != "file" { |
| 362 | parts.push(&s.name); |
| 363 | } |
| 364 | } |
| 365 | let mut qn = parts.join("::"); |
| 366 | if !qn.is_empty() { |
| 367 | qn.push_str("::"); |
| 368 | } |
| 369 | qn.push_str(name); |
| 370 | qn |
| 371 | }; |
| 372 | |
| 373 | // endLine extension (:1322-1334) — LIVE for dart: a function/method |
| 374 | // node's endLine extends to its sibling function_body's end. |
| 375 | let mut end_line = node.end_position().row as u32 + 1; |
| 376 | if let Some(ext) = extra.end_line_override { |
| 377 | if ext > end_line { |
| 378 | end_line = ext; |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | let name_ref = self.arena.put(name); |
| 383 | let qn_ref = self.arena.put(&qualified); |
| 384 | let id_ref = self.arena.put(&id); |
| 385 | let doc_ref = opt_str(&mut self.arena, extra.docstring.as_deref()); |
| 386 | let sig_ref = opt_str(&mut self.arena, extra.signature.as_deref()); |
| 387 | let ret_ref = opt_str(&mut self.arena, extra.return_type.as_deref()); |
| 388 | let mut flags = BoolFlags::default(); |
| 389 | if let Some(v) = extra.is_async { |
| 390 | flags.set(FLAG_IS_ASYNC, v); |
| 391 | } |
| 392 | if let Some(v) = extra.is_static { |
| 393 | flags.set(FLAG_IS_STATIC, v); |
| 394 | } |
| 395 | let row = self.tables.push_node(&NodeRow { |
| 396 | kind: node_kind_index(kind).unwrap(), |
| 397 | visibility: extra.visibility, |
| 398 | flags, |
| 399 | start_line, |
| 400 | end_line, |
| 401 | start_column: self.col_of(node), |
| 402 | end_column: self.end_col_of(node), |
| 403 | name: name_ref, |
| 404 | qualified_name: qn_ref, |
| 405 | id: id_ref, |
| 406 | docstring: doc_ref, |
| 407 | signature: sig_ref, |
no test coverage detected