MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / create_node

Method create_node

codegraph-kernel/src/csharp.rs:316–391  ·  view source on GitHub ↗
(&mut self, kind: &'static str, name: &str, node: Node<'t>, extra: Extra)

Source from the content-addressed store, hash-verified

314 // --- createNode ------------------------------------------------------------
315
316 fn create_node(&mut self, kind: &'static str, name: &str, node: Node<'t>, extra: Extra) -> Option<u32> {
317 if name.is_empty() {
318 return None;
319 }
320 let start_line = self.line_of(node);
321 let column = self.col_of(node);
322 let id = self.node_id_allocator.generate(self.file_path, kind, name, start_line, column);
323 let end_line = node.end_position().row as u32 + 1; // no resolveBody for csharp
324
325 let qualified = {
326 let mut parts: Vec<&str> = Vec::new();
327 for s in &self.stack {
328 if s.kind != "file" {
329 parts.push(&s.name);
330 }
331 }
332 let mut qn = parts.join("::");
333 if !qn.is_empty() {
334 qn.push_str("::");
335 }
336 qn.push_str(name);
337 qn
338 };
339
340 let mut flags = BoolFlags::default();
341 if let Some(v) = extra.is_static {
342 flags.set(FLAG_IS_STATIC, v);
343 }
344 if let Some(v) = extra.is_async {
345 flags.set(FLAG_IS_ASYNC, v);
346 }
347 let name_ref = self.arena.put(name);
348 let qn_ref = self.arena.put(&qualified);
349 let id_ref = self.arena.put(&id);
350 let doc_ref = opt_str(&mut self.arena, extra.docstring.as_deref());
351 let sig_ref = opt_str(&mut self.arena, extra.signature.as_deref());
352 let ret_ref = opt_str(&mut self.arena, extra.return_type.as_deref());
353 let row = self.tables.push_node(&NodeRow {
354 kind: node_kind_index(kind).unwrap(),
355 visibility: extra.visibility.unwrap_or(0),
356 flags,
357 start_line,
358 end_line,
359 start_column: self.col_of(node),
360 end_column: self.end_col_of(node),
361 name: name_ref,
362 qualified_name: qn_ref,
363 id: id_ref,
364 docstring: doc_ref,
365 signature: sig_ref,
366 decorators: NONE_STR, // C# extraction emits no decorators (checklist §decorators)
367 type_parameters: NONE_STR,
368 return_type: ret_ref,
369 extra_json: NONE_STR,
370 });
371 self.node_ids.push(id);
372
373 let parent_row = self.top_row();

Callers 14

extractFunction · 0.45
visit_nodeMethod · 0.45
extract_classMethod · 0.45
extract_structMethod · 0.45
extract_interfaceMethod · 0.45
extract_enumMethod · 0.45
extract_enum_membersMethod · 0.45
extract_propertyMethod · 0.45
extract_fieldMethod · 0.45
extract_methodMethod · 0.45
extract_functionMethod · 0.45
extract_variableMethod · 0.45

Calls 15

node_kind_indexFunction · 0.85
edge_kind_indexFunction · 0.85
pushMethod · 0.80
push_nodeMethod · 0.80
push_edgeMethod · 0.80
opt_strFunction · 0.70
putMethod · 0.65
unwrapMethod · 0.60
line_ofMethod · 0.45
col_ofMethod · 0.45
generateMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected