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

Method visibility_of

codegraph-kernel/src/csharp.rs:419–433  ·  view source on GitHub ↗

getVisibility: FIRST `modifier` child whose text is one of the four levels wins; none → private (the C# default).

(&self, node: Node)

Source from the content-addressed store, hash-verified

417 /// getVisibility: FIRST `modifier` child whose text is one of the four
418 /// levels wins; none → private (the C# default).
419 fn visibility_of(&self, node: Node) -> u8 {
420 for i in 0..node.child_count() {
421 let Some(child) = node.child(i) else { continue };
422 if child.kind() == "modifier" {
423 match self.text(child) {
424 "public" => return 1,
425 "private" => return 2,
426 "protected" => return 3,
427 "internal" => return 4,
428 _ => {}
429 }
430 }
431 }
432 2 // C# defaults to private
433 }
434
435 fn is_static(&self, node: Node) -> bool {
436 (0..node.child_count())

Callers 7

extract_classMethod · 0.45
extract_structMethod · 0.45
extract_enumMethod · 0.45
extract_propertyMethod · 0.45
extract_fieldMethod · 0.45
extract_methodMethod · 0.45
extract_functionMethod · 0.45

Calls 1

textMethod · 0.45

Tested by

no test coverage detected