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

Method extract_infix_call

codegraph-kernel/src/kotlin.rs:1220–1237  ·  view source on GitHub ↗

extractCall — the kotlin paths: navigation member branch (+ the #750 re-encode) and the raw-text else (paren-then-lambda / glued-invoke garbage preserved). extractKotlinInfixCall — `Users.id eq id1` / `a to b`: a call of the middle simple_identifier, `lhs.fn` when the left operand is a plain name, else the bare name; literal left operands emit nothing.

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

Source from the content-addressed store, hash-verified

1218 /// middle simple_identifier, `lhs.fn` when the left operand is a plain
1219 /// name, else the bare name; literal left operands emit nothing.
1220 fn extract_infix_call(&mut self, node: Node<'t>) {
1221 if self.stack.is_empty() || node.named_child_count() != 3 {
1222 return;
1223 }
1224 let (Some(lhs), Some(func)) = (node.named_child(0), node.named_child(1)) else { return };
1225 if func.kind() != "simple_identifier" || is_literal_receiver(lhs.kind()) {
1226 return;
1227 }
1228 let caller = self.top_row();
1229 let name = self.text(func);
1230 let receiver = if lhs.kind() == "simple_identifier" { self.text(lhs) } else { "" };
1231 let callee = if !receiver.is_empty() && receiver != "this" && receiver != "super" {
1232 format!("{receiver}.{name}")
1233 } else {
1234 name.to_string()
1235 };
1236 self.push_ref_at(caller, &callee, edge_kind_index("calls").unwrap(), node);
1237 }
1238
1239 fn extract_call(&mut self, node: Node<'t>) {
1240 if self.stack.is_empty() {

Callers 2

visit_nodeMethod · 0.80

Calls 6

edge_kind_indexFunction · 0.85
is_literal_receiverFunction · 0.70
textMethod · 0.65
unwrapMethod · 0.60
top_rowMethod · 0.45
push_ref_atMethod · 0.45

Tested by

no test coverage detected