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

Method visit_node

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

Source from the content-addressed store, hash-verified

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