The function name of the PHP call whose arguments contain `node`, if any.
(node: SyntaxNode)
| 852 | |
| 853 | /** The function name of the PHP call whose arguments contain `node`, if any. */ |
| 854 | function phpEnclosingCallName(node: SyntaxNode): string | null { |
| 855 | let cur: SyntaxNode | null = node.parent; |
| 856 | for (let hops = 0; cur && hops < 4; hops++, cur = cur.parent) { |
| 857 | if (cur.type === 'function_call_expression') { |
| 858 | const fn = getChildByField(cur, 'function'); |
| 859 | return fn ? fn.text : null; |
| 860 | } |
| 861 | if (cur.type === 'member_call_expression' || cur.type === 'scoped_call_expression') { |
| 862 | return null; // method calls aren't core HOFs |
| 863 | } |
| 864 | } |
| 865 | return null; |
| 866 | } |
| 867 | |
| 868 | /** The Ruby `call` node whose argument_list (or keyword pair) contains `node`. */ |
| 869 | function rubyEnclosingCall(node: SyntaxNode): SyntaxNode | null { |
no test coverage detected