Preserve ObjectScript's grammar/type-map resolution while feeding the invocation descriptor used by the exact callee-usage suppression pass.
| 3819 | // Preserve ObjectScript's grammar/type-map resolution while feeding the |
| 3820 | // invocation descriptor used by the exact callee-usage suppression pass. |
| 3821 | static const char *resolve_objectscript_callee(CBMExtractCtx *ctx, TSNode node, WalkState *state, |
| 3822 | const char *callee) { |
| 3823 | if (!is_objectscript_language(ctx->language)) { |
| 3824 | return callee; |
| 3825 | } |
| 3826 | |
| 3827 | const char *kind = ts_node_type(node); |
| 3828 | if ((!callee || !callee[0]) && strcmp(kind, "method_call") == 0) { |
| 3829 | callee = |
| 3830 | resolve_objectscript_instance_call(ctx->arena, node, ctx->source, &state->os_type_map); |
| 3831 | } |
| 3832 | |
| 3833 | if ((!callee || !callee[0]) && strcmp(kind, "relative_dot_method") == 0 && |
| 3834 | state->enclosing_class_qn && state->enclosing_class_qn[0]) { |
| 3835 | TSNode oref = cbm_find_child_by_kind(node, "oref_method"); |
| 3836 | TSNode method_name = |
| 3837 | ts_node_is_null(oref) ? (TSNode){0} : cbm_find_child_by_kind(oref, "method_name"); |
| 3838 | TSNode identifier = |
| 3839 | !ts_node_is_null(method_name) && ts_node_named_child_count(method_name) > 0 |
| 3840 | ? ts_node_named_child(method_name, 0) |
| 3841 | : (TSNode){0}; |
| 3842 | if (!ts_node_is_null(identifier)) { |
| 3843 | char *method = cbm_node_text(ctx->arena, identifier, ctx->source); |
| 3844 | if (method && method[0]) { |
| 3845 | callee = cbm_arena_sprintf(ctx->arena, "%s.%s", state->enclosing_class_qn, method); |
| 3846 | } |
| 3847 | } |
| 3848 | } |
| 3849 | |
| 3850 | if (callee && strncmp(callee, "$$$", 3) == 0 && ctx->macro_table) { |
| 3851 | const CBMMacroEntry *entry = cbm_macro_table_find(ctx->macro_table, callee + 3); |
| 3852 | if (entry) { |
| 3853 | if (entry->resolved_callee) { |
| 3854 | callee = cbm_arena_strdup(ctx->arena, entry->resolved_callee); |
| 3855 | } else if (entry->expansion) { |
| 3856 | callee = cbm_macro_extract_callee(ctx->arena, entry->expansion); |
| 3857 | } else { |
| 3858 | callee = NULL; |
| 3859 | } |
| 3860 | } |
| 3861 | } |
| 3862 | return callee; |
| 3863 | } |
| 3864 | |
| 3865 | static TSNode objectscript_call_args(TSNode node) { |
| 3866 | TSNode oref = cbm_find_child_by_kind(node, "oref_method"); |
no test coverage detected