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

Method visibility_of

codegraph-kernel/src/ccpp/mod.rs:716–734  ·  view source on GitHub ↗

cppExtractor.getVisibility: the FIRST access_specifier among the parent's children decides (document order, not nearest-preceding — bug-for-bug with the TS loop).

(&self, node: Node)

Source from the content-addressed store, hash-verified

714 /// parent's children decides (document order, not nearest-preceding —
715 /// bug-for-bug with the TS loop).
716 fn visibility_of(&self, node: Node) -> Option<u8> {
717 let parent = node.parent()?;
718 for i in 0..parent.child_count() {
719 let Some(child) = parent.child(i) else { continue };
720 if child.kind() == "access_specifier" {
721 let text = self.text(child);
722 if text.contains("public") {
723 return Some(1);
724 }
725 if text.contains("private") {
726 return Some(2);
727 }
728 if text.contains("protected") {
729 return Some(3);
730 }
731 }
732 }
733 None
734 }
735
736 /// cExtractor.isConst: any named `type_qualifier` child reading "const".
737 fn is_const_declaration(&self, node: Node) -> bool {

Callers 5

extract_functionMethod · 0.45
extract_methodMethod · 0.45
extract_classMethod · 0.45
extract_structMethod · 0.45
extract_enumMethod · 0.45

Calls 1

textMethod · 0.45

Tested by

no test coverage detected