| 902 | } |
| 903 | |
| 904 | static void elixir_process_call(CBMExtractCtx *ctx, TSNode call) { |
| 905 | TSNode target = ts_node_child_by_field_name(call, TS_FIELD("target")); |
| 906 | if (ts_node_is_null(target)) { |
| 907 | return; |
| 908 | } |
| 909 | char *target_text = cbm_node_text(ctx->arena, target, ctx->source); |
| 910 | if (!target_text) { |
| 911 | return; |
| 912 | } |
| 913 | |
| 914 | TSNode args = ts_node_child_by_field_name(call, TS_FIELD("arguments")); |
| 915 | |
| 916 | if (strstr(target_text, "PubSub.broadcast") || strstr(target_text, "PubSub.local_broadcast")) { |
| 917 | elixir_emit_second_arg(ctx, call, args, "phoenix_pubsub", CBM_CHANNEL_EMIT); |
| 918 | return; |
| 919 | } |
| 920 | if (strstr(target_text, "PubSub.subscribe")) { |
| 921 | elixir_emit_second_arg(ctx, call, args, "phoenix_pubsub", CBM_CHANNEL_LISTEN); |
| 922 | return; |
| 923 | } |
| 924 | if (strcmp(target_text, "push") == 0 || strcmp(target_text, "broadcast") == 0 || |
| 925 | strcmp(target_text, "broadcast!") == 0) { |
| 926 | elixir_emit_second_arg(ctx, call, args, "phoenix_channel", CBM_CHANNEL_EMIT); |
| 927 | } |
| 928 | } |
| 929 | |
| 930 | /* Detect handle_in("event", payload, socket) — Phoenix Channel listener */ |
| 931 | static void elixir_process_function_def(CBMExtractCtx *ctx, TSNode func_def) { |
no test coverage detected