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

Method visibility_of

codegraph-kernel/src/kotlin.rs:601–620  ·  view source on GitHub ↗

getVisibility: modifiers text includes public/private/protected/ internal in that order; default PUBLIC. Text-includes semantics — annotation text inside modifiers can flip it (bug-for-bug).

(&self, node: Node)

Source from the content-addressed store, hash-verified

599 /// internal in that order; default PUBLIC. Text-includes semantics —
600 /// annotation text inside modifiers can flip it (bug-for-bug).
601 fn visibility_of(&self, node: Node) -> u8 {
602 for child in node.children(&mut node.walk()) {
603 if child.kind() == "modifiers" {
604 let text = self.text(child);
605 if text.contains("public") {
606 return 1;
607 }
608 if text.contains("private") {
609 return 2;
610 }
611 if text.contains("protected") {
612 return 3;
613 }
614 if text.contains("internal") {
615 return 4;
616 }
617 }
618 }
619 1 // Kotlin defaults to public
620 }
621
622 /// isAsync: modifiers text includes 'suspend' (text-includes false
623 /// positive on `@suspendMarker` annotations — preserve).

Callers 5

try_visit_hookMethod · 0.45
extract_functionMethod · 0.45
extract_methodMethod · 0.45
extract_classMethod · 0.45
extract_enumMethod · 0.45

Calls 3

childrenMethod · 0.80
textMethod · 0.65
walkMethod · 0.45

Tested by

no test coverage detected