(&mut self, kind: &'static str, name: &str, node: Node<'t>, extra: Extra)
| 275 | } |
| 276 | |
| 277 | fn create_node(&mut self, kind: &'static str, name: &str, node: Node<'t>, extra: Extra) -> Option<u32> { |
| 278 | if name.is_empty() { |
| 279 | return None; |
| 280 | } |
| 281 | let start_line = self.line_of(node); |
| 282 | let column = self.col_of(node); |
| 283 | let id = self.node_id_allocator.generate(self.file_path, kind, name, start_line, column); |
| 284 | let end_line = node.end_position().row as u32 + 1; |
| 285 | |
| 286 | let qualified = { |
| 287 | let mut parts: Vec<&str> = Vec::new(); |
| 288 | for s in &self.stack { |
| 289 | if s.kind != "file" { |
| 290 | parts.push(&s.name); |
| 291 | } |
| 292 | } |
| 293 | let mut qn = parts.join("::"); |
| 294 | if !qn.is_empty() { |
| 295 | qn.push_str("::"); |
| 296 | } |
| 297 | qn.push_str(name); |
| 298 | qn |
| 299 | }; |
| 300 | |
| 301 | let mut flags = BoolFlags::default(); |
| 302 | if let Some(v) = extra.is_async { |
| 303 | flags.set(FLAG_IS_ASYNC, v); |
| 304 | } |
| 305 | if let Some(v) = extra.is_static { |
| 306 | flags.set(FLAG_IS_STATIC, v); |
| 307 | } |
| 308 | let name_ref = self.arena.put(name); |
| 309 | let qn_ref = self.arena.put(&qualified); |
| 310 | let id_ref = self.arena.put(&id); |
| 311 | let doc_ref = opt_str(&mut self.arena, extra.docstring.as_deref()); |
| 312 | let sig_ref = opt_str(&mut self.arena, extra.signature.as_deref()); |
| 313 | let row = self.tables.push_node(&NodeRow { |
| 314 | kind: node_kind_index(kind).unwrap(), |
| 315 | visibility: 0, |
| 316 | flags, |
| 317 | start_line, |
| 318 | end_line, |
| 319 | start_column: self.col_of(node), |
| 320 | end_column: self.end_col_of(node), |
| 321 | name: name_ref, |
| 322 | qualified_name: qn_ref, |
| 323 | id: id_ref, |
| 324 | docstring: doc_ref, |
| 325 | signature: sig_ref, |
| 326 | decorators: NONE_STR, |
| 327 | type_parameters: NONE_STR, |
| 328 | return_type: NONE_STR, |
| 329 | extra_json: NONE_STR, |
| 330 | }); |
| 331 | self.node_ids.push(id); |
| 332 | |
| 333 | let parent_row = self.top_row(); |
| 334 | self.tables.push_edge(&EdgeRow { |
no test coverage detected