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

Method visibility_of

codegraph-kernel/src/swift.rs:533–551  ·  view source on GitHub ↗

getVisibility: whole-text substring matching over `modifiers` children; default INTERNAL. `open` → internal, `fileprivate` → private (via the 'private' substring), `public private(set)` → public (first match).

(&self, node: Node)

Source from the content-addressed store, hash-verified

531 /// default INTERNAL. `open` → internal, `fileprivate` → private (via the
532 /// 'private' substring), `public private(set)` → public (first match).
533 fn visibility_of(&self, node: Node) -> u8 {
534 for i in 0..node.child_count() {
535 let Some(child) = node.child(i) else { continue };
536 if child.kind() == "modifiers" {
537 let text = self.text(child);
538 if text.contains("public") {
539 return 1;
540 }
541 if text.contains("private") {
542 return 2;
543 }
544 if text.contains("internal") {
545 return 4;
546 }
547 // 'fileprivate' arm is dead — 'private' already matched.
548 }
549 }
550 4 // Swift defaults to internal
551 }
552
553 /// isStatic: modifiers text contains 'static' OR 'class' (class members
554 /// count — deliberate; substring semantics preserved).

Callers 6

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

Calls 1

textMethod · 0.65

Tested by

no test coverage detected