| 4119 | } |
| 4120 | |
| 4121 | static TSNode language_specific_callee_expr(CBMLanguage language, TSNode node) { |
| 4122 | const char *kind = ts_node_type(node); |
| 4123 | |
| 4124 | if (is_objectscript_language(language)) { |
| 4125 | return objectscript_callee_expr(node); |
| 4126 | } |
| 4127 | |
| 4128 | if (language == CBM_LANG_SCALA && strcmp(kind, "infix_expression") == 0) { |
| 4129 | /* Scala exposes `lhs merge rhs` as left/operator/right fields. Consume |
| 4130 | * only the operator occurrence; both operands remain ordinary usages. */ |
| 4131 | return ts_node_child_by_field_name(node, TS_FIELD("operator")); |
| 4132 | } |
| 4133 | |
| 4134 | if (language == CBM_LANG_DART) { |
| 4135 | if (strcmp(kind, "selector") == 0) { |
| 4136 | TSNode previous = ts_node_prev_named_sibling(node); |
| 4137 | return !ts_node_is_null(previous) && strcmp(ts_node_type(previous), "identifier") == 0 |
| 4138 | ? previous |
| 4139 | : (TSNode){0}; |
| 4140 | } |
| 4141 | if (strcmp(kind, "new_expression") == 0) { |
| 4142 | return primary_callee_expr(node); |
| 4143 | } |
| 4144 | } |
| 4145 | |
| 4146 | if (language == CBM_LANG_VHDL && strcmp(kind, "parenthesis_group") == 0) { |
| 4147 | TSNode previous = ts_node_prev_named_sibling(node); |
| 4148 | if (!ts_node_is_null(previous)) { |
| 4149 | const char *previous_kind = ts_node_type(previous); |
| 4150 | if (strcmp(previous_kind, "library_function") == 0 || |
| 4151 | strcmp(previous_kind, "identifier") == 0 || strcmp(previous_kind, "name") == 0 || |
| 4152 | strcmp(previous_kind, "simple_name") == 0) { |
| 4153 | return previous; |
| 4154 | } |
| 4155 | } |
| 4156 | return (TSNode){0}; |
| 4157 | } |
| 4158 | |
| 4159 | if (language == CBM_LANG_CSS && strcmp(kind, "call_expression") == 0) { |
| 4160 | return cbm_find_child_by_kind(node, "function_name"); |
| 4161 | } |
| 4162 | |
| 4163 | if (language == CBM_LANG_NASM) { |
| 4164 | if (strcmp(kind, "call_syntax_expression") == 0) { |
| 4165 | return ts_node_child_by_field_name(node, TS_FIELD("base")); |
| 4166 | } |
| 4167 | if (strcmp(kind, "actual_instruction") == 0) { |
| 4168 | TSNode operands = ts_node_child_by_field_name(node, TS_FIELD("operands")); |
| 4169 | return !ts_node_is_null(operands) && ts_node_named_child_count(operands) > 0 |
| 4170 | ? ts_node_named_child(operands, 0) |
| 4171 | : (TSNode){0}; |
| 4172 | } |
| 4173 | } |
| 4174 | |
| 4175 | if (language == CBM_LANG_LLVM_IR) { |
| 4176 | return ts_node_child_by_field_name(node, TS_FIELD("callee")); |
| 4177 | } |
| 4178 |
no test coverage detected