| 810 | } |
| 811 | |
| 812 | static bool is_exact_language_binding(CBMExtractCtx *ctx, TSNode node, WalkState *state) { |
| 813 | const char *kind = ts_node_type(node); |
| 814 | switch (ctx->language) { |
| 815 | case CBM_LANG_OCAML: { |
| 816 | if (strcmp(kind, "value_pattern") != 0) { |
| 817 | return false; |
| 818 | } |
| 819 | TSNode parameter = ts_node_parent(node); |
| 820 | return !ts_node_is_null(parameter) && strcmp(ts_node_type(parameter), "parameter") == 0 && |
| 821 | field_contains_node(parameter, "pattern", node); |
| 822 | } |
| 823 | case CBM_LANG_SCSS: { |
| 824 | if (strcmp(kind, "variable_name") != 0) { |
| 825 | return false; |
| 826 | } |
| 827 | TSNode parameter = ts_node_parent(node); |
| 828 | return !ts_node_is_null(parameter) && strcmp(ts_node_type(parameter), "parameter") == 0; |
| 829 | } |
| 830 | case CBM_LANG_FORM: { |
| 831 | if (strcmp(kind, "parameter") != 0) { |
| 832 | return false; |
| 833 | } |
| 834 | TSNode parameters = ts_node_parent(node); |
| 835 | return !ts_node_is_null(parameters) && |
| 836 | strcmp(ts_node_type(parameters), "parameter_list") == 0; |
| 837 | } |
| 838 | case CBM_LANG_FUNC: { |
| 839 | if (strcmp(kind, "parameter") != 0) { |
| 840 | return false; |
| 841 | } |
| 842 | TSNode declaration = ts_node_parent(node); |
| 843 | return !ts_node_is_null(declaration) && |
| 844 | strcmp(ts_node_type(declaration), "parameter_declaration") == 0 && |
| 845 | field_contains_node(declaration, "name", node); |
| 846 | } |
| 847 | case CBM_LANG_PERL: |
| 848 | return is_perl_lexical_declaration_binding(node); |
| 849 | case CBM_LANG_CMAKE: |
| 850 | return is_cmake_function_parameter(node); |
| 851 | case CBM_LANG_FISH: |
| 852 | return is_fish_function_parameter(ctx, node, state); |
| 853 | case CBM_LANG_TCL: |
| 854 | return is_tcl_procedure_parameter(node); |
| 855 | case CBM_LANG_CFML: |
| 856 | return cfml_argument_tag_name_binding(ctx, node); |
| 857 | default: |
| 858 | return false; |
| 859 | } |
| 860 | } |
| 861 | |
| 862 | static bool ancestor_field_binds(TSNode node, const char *container_kind, |
| 863 | const char *const *fields) { |
no test coverage detected