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:2179–2193  ·  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

2177 /// declaring a field or a top-level variable, not the second variable of
2178 /// a local declaration (`for (var i = 0, j = n(); …)`).
2179 fn is_field_or_top_level_entry(&self, node: Node<'t>) -> bool {
2180 let Some(list) = node.parent() else { return false };
2181 if list.kind() != "initialized_identifier_list" {
2182 return false;
2183 }
2184 let Some(owner) = list.parent() else { return false };
2185 if owner.kind() == "program" {
2186 return true;
2187 }
2188 owner.kind() == "declaration"
2189 && owner
2190 .parent()
2191 .map(|p| matches!(p.kind(), "class_body" | "extension_body" | "enum_body"))
2192 .unwrap_or(false)
2193 }
2194
2195 /// dartMemberRead (dart.ts) — `x.area` / `x?.area` not followed by a call's
2196 /// 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