* 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)
| 547 | * wrapper. Mirrored in the kernel's swift.rs. |
| 548 | */ |
| 549 | function 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. */ |
| 555 | function swiftWrappedOperand(node: SyntaxNode): SyntaxNode | null { |
no test coverage detected