getVisibility: FIRST `modifier` child whose text is one of the four levels wins; none → public in an interface, internal in a namespace or the file, private in a class or struct (the C# defaults).
(&self, node: Node)
| 420 | /// levels wins; none → public in an interface, internal in a namespace |
| 421 | /// or the file, private in a class or struct (the C# defaults). |
| 422 | fn visibility_of(&self, node: Node) -> u8 { |
| 423 | for i in 0..node.child_count() { |
| 424 | let Some(child) = node.child(i) else { continue }; |
| 425 | if child.kind() == "modifier" { |
| 426 | match self.text(child) { |
| 427 | "public" => return 1, |
| 428 | "private" => return 2, |
| 429 | "protected" => return 3, |
| 430 | "internal" => return 4, |
| 431 | _ => {} |
| 432 | } |
| 433 | } |
| 434 | } |
| 435 | let parent = node.parent(); |
| 436 | let container = match parent { |
| 437 | Some(p) if p.kind() == "declaration_list" => p.parent(), |
| 438 | other => other, |
| 439 | }; |
| 440 | match container.map(|c| c.kind()) { |
| 441 | Some("interface_declaration") => 1, |
| 442 | None | Some("compilation_unit") | Some("namespace_declaration") |
| 443 | | Some("file_scoped_namespace_declaration") => 4, |
| 444 | _ => 2, |
| 445 | } |
| 446 | } |
| 447 | |
| 448 | fn is_static(&self, node: Node) -> bool { |
| 449 | (0..node.child_count()) |
no test coverage detected