(&mut self, kind: &'static str, name: &str, node: Node<'t>, extra: Extra)
| 327 | // --- createNode ------------------------------------------------------------ |
| 328 | |
| 329 | fn create_node(&mut self, kind: &'static str, name: &str, node: Node<'t>, extra: Extra) -> Option<u32> { |
| 330 | if name.is_empty() { |
| 331 | return None; |
| 332 | } |
| 333 | let start_line = self.line_of(node); |
| 334 | let id = ids::node_id(self.file_path, kind, name, start_line); |
| 335 | let end_line = node.end_position().row as u32 + 1; // no resolveBody for swift |
| 336 | |
| 337 | let qualified = { |
| 338 | let mut parts: Vec<&str> = Vec::new(); |
| 339 | for s in &self.stack { |
| 340 | if s.kind != "file" { |
| 341 | parts.push(&s.name); |
| 342 | } |
| 343 | } |
| 344 | let mut qn = parts.join("::"); |
| 345 | if !qn.is_empty() { |
| 346 | qn.push_str("::"); |
| 347 | } |
| 348 | qn.push_str(name); |
| 349 | qn |
| 350 | }; |
| 351 | |
| 352 | let mut flags = BoolFlags::default(); |
| 353 | if let Some(v) = extra.is_exported { |
| 354 | flags.set(FLAG_IS_EXPORTED, v); |
| 355 | } |
| 356 | if let Some(v) = extra.is_async { |
| 357 | flags.set(FLAG_IS_ASYNC, v); |
| 358 | } |
| 359 | if let Some(v) = extra.is_static { |
| 360 | flags.set(FLAG_IS_STATIC, v); |
| 361 | } |
| 362 | let name_ref = self.arena.put(name); |
| 363 | let qn_ref = self.arena.put(&qualified); |
| 364 | let id_ref = self.arena.put(&id); |
| 365 | let doc_ref = opt_str(&mut self.arena, extra.docstring.as_deref()); |
| 366 | let sig_ref = opt_str(&mut self.arena, extra.signature.as_deref()); |
| 367 | let ret_ref = opt_str(&mut self.arena, extra.return_type.as_deref()); |
| 368 | let row = self.tables.push_node(&NodeRow { |
| 369 | kind: node_kind_index(kind).unwrap(), |
| 370 | visibility: extra.visibility.unwrap_or(0), |
| 371 | flags, |
| 372 | start_line, |
| 373 | end_line, |
| 374 | start_column: self.col_of(node), |
| 375 | end_column: self.end_col_of(node), |
| 376 | name: name_ref, |
| 377 | qualified_name: qn_ref, |
| 378 | id: id_ref, |
| 379 | docstring: doc_ref, |
| 380 | signature: sig_ref, |
| 381 | decorators: NONE_STR, // extractModifiers absent — never set from modifiers |
| 382 | type_parameters: NONE_STR, |
| 383 | return_type: ret_ref, |
| 384 | extra_json: NONE_STR, |
| 385 | }); |
| 386 | self.node_ids.push(id); |
no test coverage detected