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

Function isSwiftCallWrapper

src/extraction/tree-sitter.ts:549–552  ·  view source on GitHub ↗

* Swift wrappers that leave a call's target the same. tree-sitter-swift binds * a prefix operator to the leftmost operand, so `!isReady()` parses as * `(!isReady)()` and `!store.contains(x)` as `(!store).contains(x)`; and * `try`/`await` (and Swift 6.2's `unsafe`) before a chain bind to the part

(node: SyntaxNode, source: string)

Source from the content-addressed store, hash-verified

547 * wrapper. Mirrored in the kernel's swift.rs.
548 */
549function isSwiftCallWrapper(node: SyntaxNode, source: string): boolean {
550 if (node.type === 'try_expression' || node.type === 'await_expression' || node.type === 'unsafe_expression') return true;
551 return node.type === 'prefix_expression' && !getNodeText(node, source).startsWith('.');
552}
553
554/** The operand a {@link isSwiftCallWrapper} wraps. */
555function swiftWrappedOperand(node: SyntaxNode): SyntaxNode | null {

Callers 2

peelSwiftCallWrappersFunction · 0.85
swiftUnwrappedTextFunction · 0.85

Calls 1

getNodeTextFunction · 0.90

Tested by

no test coverage detected