Detect handle_in("event", payload, socket) — Phoenix Channel listener */
| 929 | |
| 930 | /* Detect handle_in("event", payload, socket) — Phoenix Channel listener */ |
| 931 | static void elixir_process_function_def(CBMExtractCtx *ctx, TSNode func_def) { |
| 932 | TSNode name_node = ts_node_child_by_field_name(func_def, TS_FIELD("name")); |
| 933 | if (ts_node_is_null(name_node)) { |
| 934 | return; |
| 935 | } |
| 936 | char *name = cbm_node_text(ctx->arena, name_node, ctx->source); |
| 937 | if (!name || strcmp(name, "handle_in") != 0) { |
| 938 | return; |
| 939 | } |
| 940 | /* First parameter is the event name pattern */ |
| 941 | TSNode params = ts_node_child_by_field_name(func_def, TS_FIELD("parameters")); |
| 942 | if (ts_node_is_null(params)) { |
| 943 | return; |
| 944 | } |
| 945 | uint32_t pc = ts_node_named_child_count(params); |
| 946 | if (pc == 0) { |
| 947 | return; |
| 948 | } |
| 949 | TSNode first_param = ts_node_named_child(params, 0); |
| 950 | const char *val = literal_from_arg(ctx, first_param); |
| 951 | if (!val) { |
| 952 | val = literal_from_first_child(ctx, first_param); |
| 953 | } |
| 954 | if (val) { |
| 955 | push_channel(ctx, val, "phoenix_channel", CBM_CHANNEL_LISTEN, func_def); |
| 956 | } |
| 957 | } |
| 958 | |
| 959 | static void extract_channels_elixir(CBMExtractCtx *ctx) { |
| 960 | TSNodeStack stack; |
no test coverage detected