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)
| 429 | /// levels wins; none → public in an interface, internal in a namespace |
| 430 | /// or the file, private in a class or struct (the C# defaults). |
| 431 | fn visibility_of(&self, node: Node) -> u8 { |
| 432 | for i in 0..node.child_count() { |
| 433 | let Some(child) = node.child(i) else { continue }; |
| 434 | if child.kind() == "modifier" { |
| 435 | match self.text(child) { |
| 436 | "public" => return 1, |
| 437 | "private" => return 2, |
| 438 | "protected" => return 3, |
| 439 | "internal" => return 4, |
| 440 | _ => {} |
| 441 | } |
| 442 | } |
| 443 | } |
| 444 | let parent = node.parent(); |
| 445 | let container = match parent { |
| 446 | Some(p) if p.kind() == "declaration_list" => p.parent(), |
| 447 | other => other, |
| 448 | }; |
| 449 | match container.map(|c| c.kind()) { |
| 450 | Some("interface_declaration") => 1, |
| 451 | None | Some("compilation_unit") | Some("namespace_declaration") |
| 452 | | Some("file_scoped_namespace_declaration") => 4, |
| 453 | _ => 2, |
| 454 | } |
| 455 | } |
| 456 | |
| 457 | fn is_static(&self, node: Node) -> bool { |
| 458 | (0..node.child_count()) |
no test coverage detected