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

Method visibility_of

codegraph-kernel/src/dart.rs:587–605  ·  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

585 /// constructor is public (the unwrap misses ctor signatures / the name
586 /// FIELD is the class identifier).
587 fn visibility_of(&self, node: Node<'t>) -> u8 {
588 let name_node = if node.kind() == "method_signature" {
589 let mut cursor = node.walk();
590 let inner = node.named_children(&mut cursor).find(|c| {
591 matches!(c.kind(), "function_signature" | "getter_signature" | "setter_signature")
592 });
593 inner.and_then(|i| {
594 let mut ic = i.walk();
595 let found = i.named_children(&mut ic).find(|c| c.kind() == "identifier");
596 found
597 })
598 } else {
599 node.child_by_field_name("name")
600 };
601 match name_node {
602 Some(n) if self.text(n).starts_with('_') => 2,
603 _ => 1,
604 }
605 }
606
607 /// isAsync (dart.ts:223-233) — the `async` anon child of the SIBLING
608 /// 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