Resolve function name for FP/scientific languages.
| 498 | |
| 499 | // Resolve function name for FP/scientific languages. |
| 500 | static TSNode resolve_func_name_fp(TSNode node, CBMLanguage lang, const char *kind, TSNode name) { |
| 501 | if (lang == CBM_LANG_COMMONLISP && strcmp(kind, "defun") == 0) { |
| 502 | return resolve_commonlisp_func_name(node); |
| 503 | } |
| 504 | |
| 505 | if (lang == CBM_LANG_MAKEFILE && strcmp(kind, "rule") == 0) { |
| 506 | return resolve_makefile_func_name(node); |
| 507 | } |
| 508 | |
| 509 | if (lang == CBM_LANG_HASKELL && strcmp(kind, "function") == 0) { |
| 510 | return resolve_haskell_func_name(node); |
| 511 | } |
| 512 | |
| 513 | if (lang == CBM_LANG_ELM && strcmp(kind, "value_declaration") == 0) { |
| 514 | return resolve_elm_func_name(node); |
| 515 | } |
| 516 | |
| 517 | if (lang == CBM_LANG_MATLAB && strcmp(kind, "function_definition") == 0) { |
| 518 | if (!ts_node_is_null(name)) { |
| 519 | return name; |
| 520 | } |
| 521 | return cbm_find_child_by_kind(node, "identifier"); |
| 522 | } |
| 523 | |
| 524 | if (lang == CBM_LANG_LEAN) { |
| 525 | return resolve_lean_func_name(node, name); |
| 526 | } |
| 527 | |
| 528 | if (lang == CBM_LANG_WOLFRAM && |
| 529 | (strcmp(kind, "set_delayed_top") == 0 || strcmp(kind, "set_top") == 0 || |
| 530 | strcmp(kind, "set_delayed") == 0 || strcmp(kind, "set") == 0)) { |
| 531 | return resolve_wolfram_func_name(node); |
| 532 | } |
| 533 | |
| 534 | TSNode null_node = {0}; |
| 535 | return null_node; |
| 536 | } |
| 537 | |
| 538 | // C++/CUDA: out-of-line method definitions name the function with a qualified |
| 539 | // declarator (`Foo::bar`, or `ns::Foo::bar`). Return the immediate enclosing |
no test coverage detected