MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / cpp_access

Function cpp_access

atomic-audit/src/extract/languages.rs:684–709  ·  view source on GitHub ↗
(node: Node<'_>, source: &str)

Source from the content-addressed store, hash-verified

682}
683
684fn cpp_access(node: Node<'_>, source: &str) -> bool {
685 let mut current = node;
686 while let Some(parent) = current.parent() {
687 if parent.kind() == "field_declaration_list" {
688 let mut public = parent
689 .parent()
690 .is_some_and(|owner| owner.kind() == "struct_specifier");
691 for child in named(parent) {
692 if child.id() == current.id() {
693 break;
694 }
695 if child.kind() == "access_specifier" {
696 public = matches!(text(child, source), "public" | "protected");
697 }
698 }
699 if !public {
700 return false;
701 }
702 }
703 if parent.kind() == "namespace_definition" && parent.child_by_field_name("name").is_none() {
704 return false;
705 }
706 current = parent;
707 }
708 true
709}
710
711fn exported_ts(mut node: Node<'_>, source: &str) -> bool {
712 loop {

Callers 1

public_surfaceFunction · 0.85

Calls 5

parentMethod · 0.80
is_noneMethod · 0.80
namedFunction · 0.70
kindMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected