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

Method visit_node

codegraph-kernel/src/csharp.rs:515–635  ·  view source on GitHub ↗
(&mut self, node: Node<'t>)

Source from the content-addressed store, hash-verified

513 // --- the dispatcher (visitNode, C#-relevant branches) -----------------------
514
515 fn visit_node(&mut self, node: Node<'t>) {
516 stack_guard!();
517 let kind = node.kind();
518 let mut skip_children = false;
519
520 // A block namespace scopes only its body (tree-sitter.ts visitNode):
521 // one written inside another is `Outer.Inner`, taking the outer's
522 // place on the stack while its body is walked.
523 if kind == "namespace_declaration" {
524 if let Some(ns_name) = namespace_name(self, node) {
525 let outer = match self.stack.last() {
526 Some(top) if top.kind == "namespace" => self.stack.pop(),
527 _ => None,
528 };
529 let full = match &outer {
530 Some(o) => format!("{}.{}", o.name, ns_name),
531 None => ns_name,
532 };
533 let row = self.create_node("namespace", &full, node, Extra::default());
534 if let Some(row) = row {
535 self.stack.push(Scope { row, kind: "namespace", name: full });
536 }
537 for i in 0..node.named_child_count() {
538 if let Some(c) = node.named_child(i) {
539 self.visit_node(c);
540 }
541 }
542 if row.is_some() {
543 self.stack.pop();
544 }
545 if let Some(o) = outer {
546 self.stack.push(o);
547 }
548 return;
549 }
550 }
551
552 self.maybe_capture_fn_refs(node);
553
554 if kind == "class_declaration" || kind == "record_declaration" {
555 // classifyClassNode: `record struct` → extractStruct, else class.
556 if kind == "record_declaration" && record_is_struct(node) {
557 self.extract_struct(node);
558 } else {
559 self.extract_class(node);
560 }
561 skip_children = true;
562 } else if kind == "method_declaration" || kind == "constructor_declaration" {
563 self.extract_method(node);
564 skip_children = true;
565 } else if kind == "interface_declaration" {
566 self.extract_interface(node);
567 skip_children = true;
568 } else if kind == "struct_declaration" || kind == "record_struct_declaration" {
569 self.extract_struct(node);
570 skip_children = true;
571 } else if kind == "enum_declaration" {
572 self.extract_enum(node);

Callers 6

extractFunction · 0.45
extract_classMethod · 0.45
extract_structMethod · 0.45
extract_interfaceMethod · 0.45
extract_enumMethod · 0.45

Calls 15

namespace_nameFunction · 0.85
record_is_structFunction · 0.85
property_bodiesFunction · 0.85
pushMethod · 0.80
mapMethod · 0.80
idMethod · 0.80
create_nodeMethod · 0.45
maybe_capture_fn_refsMethod · 0.45
extract_structMethod · 0.45
extract_classMethod · 0.45

Tested by

no test coverage detected