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

Method is_foreign_field

codegraph-kernel/src/java.rs:1290–1306  ·  view source on GitHub ↗

isForeignJavaField: `InferenceString.PARSER` reads that class's constant, not the `PARSER` of the file reading it.

(&self, n: Node<'t>, target_row: u32)

Source from the content-addressed store, hash-verified

1288 /// isForeignJavaField: `InferenceString.PARSER` reads that class's constant,
1289 /// not the `PARSER` of the file reading it.
1290 fn is_foreign_field(&self, n: Node<'t>, target_row: u32) -> bool {
1291 let Some(access) = n.parent() else { return false };
1292 if access.kind() != "field_access" {
1293 return false;
1294 }
1295 let Some(object) = access.child_by_field_name("object") else { return false };
1296 if access.child_by_field_name("field").map(|f| f.start_byte()) != Some(n.start_byte()) {
1297 return false;
1298 }
1299 let written = self.text(object);
1300 let qualifier = written.rsplit('.').next().unwrap_or("").trim();
1301 if qualifier == "this" {
1302 return false;
1303 }
1304 let qualified = &self.nodes_meta[target_row as usize].qualified_name;
1305 qualified.rsplit("::").nth(1) != Some(qualifier)
1306 }
1307
1308 fn flush_value_refs(&mut self, root: Node<'t>) {
1309 let scopes = std::mem::take(&mut self.value_scopes);

Callers 1

flush_value_refsMethod · 0.80

Calls 3

mapMethod · 0.80
nextMethod · 0.80
textMethod · 0.65

Tested by

no test coverage detected