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

Method receiver_of

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

dartReceiverOf (dart.ts) — the receiver of the member access `selector`: the node in front of it, past comments, or the end of an arrow function's body when the grammar ended the arrow in front of a generic call (`(ref) => ref.watch (p)` → `((ref) => ref).watch (p)`).

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

Source from the content-addressed store, hash-verified

1281 /// arrow function's body when the grammar ended the arrow in front of a
1282 /// generic call (`(ref) => ref.watch<int>(p)` → `((ref) => ref).watch<int>(p)`).
1283 fn receiver_of(&self, selector: Node<'t>) -> Option<Node<'t>> {
1284 let prev = prev_named(selector);
1285 let body = prev
1286 .filter(|p| p.kind() == "function_expression")
1287 .and_then(|p| p.named_child(p.named_child_count().checked_sub(1)?));
1288 match body {
1289 Some(body) if body.kind() == "function_expression_body" => {
1290 body.named_child(body.named_child_count().checked_sub(1)?)
1291 }
1292 _ => prev,
1293 }
1294 }
1295
1296 /// dartCallee (dart.ts) — the callee name of the call whose argument part
1297 /// follows `prev`.

Callers 2

callee_nameMethod · 0.80

Calls 1

prev_namedFunction · 0.85

Tested by

no test coverage detected