| 2958 | } |
| 2959 | |
| 2960 | static TSNode language_specific_callee_expr(CBMLanguage language, TSNode node) { |
| 2961 | const char *kind = ts_node_type(node); |
| 2962 | |
| 2963 | if (is_objectscript_language(language)) { |
| 2964 | return objectscript_callee_expr(node); |
| 2965 | } |
| 2966 | |
| 2967 | if (language == CBM_LANG_SCALA && strcmp(kind, "infix_expression") == 0) { |
| 2968 | /* Scala exposes `lhs merge rhs` as left/operator/right fields. Consume |
| 2969 | * only the operator occurrence; both operands remain ordinary usages. */ |
| 2970 | return ts_node_child_by_field_name(node, TS_FIELD("operator")); |
| 2971 | } |
| 2972 | |
| 2973 | if (language == CBM_LANG_DART) { |
| 2974 | if (strcmp(kind, "selector") == 0) { |
| 2975 | TSNode previous = ts_node_prev_named_sibling(node); |
| 2976 | return !ts_node_is_null(previous) && strcmp(ts_node_type(previous), "identifier") == 0 |
| 2977 | ? previous |
| 2978 | : (TSNode){0}; |
| 2979 | } |
| 2980 | if (strcmp(kind, "new_expression") == 0) { |
| 2981 | return primary_callee_expr(node); |
| 2982 | } |
| 2983 | } |
| 2984 | |
| 2985 | if (language == CBM_LANG_VHDL && strcmp(kind, "parenthesis_group") == 0) { |
| 2986 | TSNode previous = ts_node_prev_named_sibling(node); |
| 2987 | if (!ts_node_is_null(previous)) { |
| 2988 | const char *previous_kind = ts_node_type(previous); |
| 2989 | if (strcmp(previous_kind, "library_function") == 0 || |
| 2990 | strcmp(previous_kind, "identifier") == 0 || strcmp(previous_kind, "name") == 0 || |
| 2991 | strcmp(previous_kind, "simple_name") == 0) { |
| 2992 | return previous; |
| 2993 | } |
| 2994 | } |
| 2995 | return (TSNode){0}; |
| 2996 | } |
| 2997 | |
| 2998 | if (language == CBM_LANG_CSS && strcmp(kind, "call_expression") == 0) { |
| 2999 | return cbm_find_child_by_kind(node, "function_name"); |
| 3000 | } |
| 3001 | |
| 3002 | if (language == CBM_LANG_NASM) { |
| 3003 | if (strcmp(kind, "call_syntax_expression") == 0) { |
| 3004 | return ts_node_child_by_field_name(node, TS_FIELD("base")); |
| 3005 | } |
| 3006 | if (strcmp(kind, "actual_instruction") == 0) { |
| 3007 | TSNode operands = ts_node_child_by_field_name(node, TS_FIELD("operands")); |
| 3008 | return !ts_node_is_null(operands) && ts_node_named_child_count(operands) > 0 |
| 3009 | ? ts_node_named_child(operands, 0) |
| 3010 | : (TSNode){0}; |
| 3011 | } |
| 3012 | } |
| 3013 | |
| 3014 | if (language == CBM_LANG_LLVM_IR) { |
| 3015 | return ts_node_child_by_field_name(node, TS_FIELD("callee")); |
| 3016 | } |
| 3017 |
no test coverage detected