(&mut self, kind: &'static str, name: &str, node: Node<'t>, extra: Extra)
| 296 | // --- createNode ------------------------------------------------------------ |
| 297 | |
| 298 | fn create_node(&mut self, kind: &'static str, name: &str, node: Node<'t>, extra: Extra) -> Option<u32> { |
| 299 | if name.is_empty() { |
| 300 | return None; |
| 301 | } |
| 302 | let start_line = self.line_of(node); |
| 303 | let id = ids::node_id(self.file_path, kind, name, start_line); |
| 304 | let end_line = node.end_position().row as u32 + 1; // no resolveBody for java |
| 305 | |
| 306 | let qualified = { |
| 307 | let mut parts: Vec<&str> = Vec::new(); |
| 308 | for s in &self.stack { |
| 309 | if s.kind != "file" { |
| 310 | parts.push(&s.name); |
| 311 | } |
| 312 | } |
| 313 | let mut qn = parts.join("::"); |
| 314 | if !qn.is_empty() { |
| 315 | qn.push_str("::"); |
| 316 | } |
| 317 | qn.push_str(name); |
| 318 | qn |
| 319 | }; |
| 320 | |
| 321 | let mut flags = BoolFlags::default(); |
| 322 | if let Some(v) = extra.is_static { |
| 323 | flags.set(FLAG_IS_STATIC, v); |
| 324 | } |
| 325 | let name_ref = self.arena.put(name); |
| 326 | let qn_ref = self.arena.put(&qualified); |
| 327 | let id_ref = self.arena.put(&id); |
| 328 | let doc_ref = opt_str(&mut self.arena, extra.docstring.as_deref()); |
| 329 | let sig_ref = opt_str(&mut self.arena, extra.signature.as_deref()); |
| 330 | let ret_ref = opt_str(&mut self.arena, extra.return_type.as_deref()); |
| 331 | let dec_ref: StrRef = match &extra.decorators { |
| 332 | Some(list) if !list.is_empty() => self.arena.put_list(list), |
| 333 | _ => NONE_STR, |
| 334 | }; |
| 335 | let row = self.tables.push_node(&NodeRow { |
| 336 | kind: node_kind_index(kind).unwrap(), |
| 337 | visibility: extra.visibility.unwrap_or(0), |
| 338 | flags, |
| 339 | start_line, |
| 340 | end_line, |
| 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: dec_ref, |
| 349 | type_parameters: NONE_STR, |
| 350 | return_type: ret_ref, |
| 351 | extra_json: NONE_STR, |
| 352 | }); |
| 353 | self.nodes_meta.push(NodeMeta { kind, name: name.to_string(), qualified_name: qualified }); |
| 354 | self.node_ids.push(id); |
| 355 |
no test coverage detected