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

Method create_node

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

Source from the content-addressed store, hash-verified

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

Callers 13

extractFunction · 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
extract_importMethod · 0.45

Calls 15

node_idFunction · 0.85
node_kind_indexFunction · 0.85
edge_kind_indexFunction · 0.85
putMethod · 0.80
push_nodeMethod · 0.80
push_edgeMethod · 0.80
opt_strFunction · 0.70
unwrapMethod · 0.60
line_ofMethod · 0.45
joinMethod · 0.45
setMethod · 0.45
col_ofMethod · 0.45

Tested by

no test coverage detected