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

Method visibility_of

codegraph-kernel/src/dart.rs:658–682  ·  view source on GitHub ↗

getVisibility (dart.ts:209-222) — `_` prefix = private; every constructor is public (the unwrap misses ctor signatures / the name FIELD is the class identifier).

(&self, node: Node<'t>)

Source from the content-addressed store, hash-verified

656 /// constructor is public (the unwrap misses ctor signatures / the name
657 /// FIELD is the class identifier).
658 fn visibility_of(&self, node: Node<'t>) -> u8 {
659 // A `const` constructor is public, as d4d8f3e's grammar gave it no
660 // `name` field: 0038280 names its class there (`_Impl` in `const
661 // _Impl.named()`), which says nothing of the constructor's own.
662 if node.kind() == "constant_constructor_signature" {
663 return 1;
664 }
665 let name_node = if node.kind() == "method_signature" {
666 let mut cursor = node.walk();
667 let inner = node.named_children(&mut cursor).find(|c| {
668 matches!(c.kind(), "function_signature" | "getter_signature" | "setter_signature")
669 });
670 inner.and_then(|i| {
671 let mut ic = i.walk();
672 let found = i.named_children(&mut ic).find(|c| c.kind() == "identifier");
673 found
674 })
675 } else {
676 node.child_by_field_name("name")
677 };
678 match name_node {
679 Some(n) if self.text(n).starts_with('_') => 2,
680 _ => 1,
681 }
682 }
683
684 /// isAsync (dart.ts:223-233) — the `async` anon child of the SIBLING
685 /// function_body; `async*`/`sync*` are different token types → false.

Callers 4

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

Calls 2

walkMethod · 0.80
textMethod · 0.65

Tested by

no test coverage detected