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

Method visibility_of

codegraph-kernel/src/swift.rs:534–552  ·  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

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