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

Method visibility_of

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

460 /// default INTERNAL. `open` → internal, `fileprivate` → private (via the
461 /// 'private' substring), `public private(set)` → public (first match).
462 fn visibility_of(&self, node: Node) -> u8 {
463 for i in 0..node.child_count() {
464 let Some(child) = node.child(i) else { continue };
465 if child.kind() == "modifiers" {
466 let text = self.text(child);
467 if text.contains("public") {
468 return 1;
469 }
470 if text.contains("private") {
471 return 2;
472 }
473 if text.contains("internal") {
474 return 4;
475 }
476 // 'fileprivate' arm is dead — 'private' already matched.
477 }
478 }
479 4 // Swift defaults to internal
480 }
481
482 /// isStatic: modifiers text contains 'static' OR 'class' (class members
483 /// 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