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

Method is_field_or_top_level_entry

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

isDartFieldOrTopLevelEntry (dart.ts) — an `initialized_identifier` declaring a field or a top-level variable, not the second variable of a local declaration (`for (var i = 0, j = n(); …)`).

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

Source from the content-addressed store, hash-verified

2184 /// declaring a field or a top-level variable, not the second variable of
2185 /// a local declaration (`for (var i = 0, j = n(); …)`).
2186 fn is_field_or_top_level_entry(&self, node: Node<'t>) -> bool {
2187 let Some(list) = node.parent() else { return false };
2188 if list.kind() != "initialized_identifier_list" {
2189 return false;
2190 }
2191 let Some(owner) = list.parent() else { return false };
2192 if owner.kind() == "program" {
2193 return true;
2194 }
2195 owner.kind() == "declaration"
2196 && owner
2197 .parent()
2198 .map(|p| matches!(p.kind(), "class_body" | "extension_body" | "enum_body"))
2199 .unwrap_or(false)
2200 }
2201
2202 /// dartMemberRead (dart.ts) — `x.area` / `x?.area` not followed by a call's
2203 /// argument part, receiver a plain name: a `references` ref `x.area` on

Callers 1

visitMethod · 0.80

Calls 1

mapMethod · 0.80

Tested by

no test coverage detected