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

Function is_call_wrapper

codegraph-kernel/src/swift.rs:136–142  ·  view source on GitHub ↗

isSwiftCallWrapper (tree-sitter.ts): a wrapper that leaves a call's target the same — `try`/`await`, which before a chain bind to the part before its last call (`try! A().b()` is `(try! A()).b()`), or a prefix operator, which binds to the leftmost operand (`!isReady()` is `(!isReady)()`). An implicit member's leading `.` (`.success(x)`) is part of the name.

(node: Node, src: &str)

Source from the content-addressed store, hash-verified

134/// binds to the leftmost operand (`!isReady()` is `(!isReady)()`). An implicit
135/// member's leading `.` (`.success(x)`) is part of the name.
136fn is_call_wrapper(node: Node, src: &str) -> bool {
137 match node.kind() {
138 "try_expression" | "await_expression" => true,
139 "prefix_expression" => !src[node.byte_range()].starts_with('.'),
140 _ => false,
141 }
142}
143
144/// swiftWrappedOperand: the operand a call wrapper wraps.
145fn wrapped_operand<'t>(node: Node<'t>) -> Option<Node<'t>> {

Callers 2

peel_call_wrappersFunction · 0.85
unwrapped_textFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected