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

Method extract_infix_call

codegraph-kernel/src/kotlin.rs:1178–1195  ·  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

1176 /// middle simple_identifier, `lhs.fn` when the left operand is a plain
1177 /// name, else the bare name; literal left operands emit nothing.
1178 fn extract_infix_call(&mut self, node: Node<'t>) {
1179 if self.stack.is_empty() || node.named_child_count() != 3 {
1180 return;
1181 }
1182 let (Some(lhs), Some(func)) = (node.named_child(0), node.named_child(1)) else { return };
1183 if func.kind() != "simple_identifier" || is_literal_receiver(lhs.kind()) {
1184 return;
1185 }
1186 let caller = self.top_row();
1187 let name = self.text(func);
1188 let receiver = if lhs.kind() == "simple_identifier" { self.text(lhs) } else { "" };
1189 let callee = if !receiver.is_empty() && receiver != "this" && receiver != "super" {
1190 format!("{receiver}.{name}")
1191 } else {
1192 name.to_string()
1193 };
1194 self.push_ref_at(caller, &callee, edge_kind_index("calls").unwrap(), node);
1195 }
1196
1197 fn extract_call(&mut self, node: Node<'t>) {
1198 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