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

Method visibility_of

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

526 /// default INTERNAL. `open` → internal, `fileprivate` → private (via the
527 /// 'private' substring), `public private(set)` → public (first match).
528 fn visibility_of(&self, node: Node) -> u8 {
529 for child in node.children(&mut node.walk()) {
530 if child.kind() == "modifiers" {
531 let text = self.text(child);
532 if text.contains("public") {
533 return 1;
534 }
535 if text.contains("private") {
536 return 2;
537 }
538 if text.contains("internal") {
539 return 4;
540 }
541 // 'fileprivate' arm is dead — 'private' already matched.
542 }
543 }
544 4 // Swift defaults to internal
545 }
546
547 /// isStatic: modifiers text contains 'static' OR 'class' (class members
548 /// 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 3

childrenMethod · 0.80
textMethod · 0.65
walkMethod · 0.45

Tested by

no test coverage detected