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

Method visit_node

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

Source from the content-addressed store, hash-verified

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

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
walkMethod · 0.45
maybe_capture_fn_refsMethod · 0.45
extract_structMethod · 0.45

Tested by

no test coverage detected