MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / elixir_process_function_def

Function elixir_process_function_def

internal/cbm/extract_channels.c:931–957  ·  view source on GitHub ↗

Detect handle_in("event", payload, socket) — Phoenix Channel listener */

Source from the content-addressed store, hash-verified

929
930/* Detect handle_in("event", payload, socket) — Phoenix Channel listener */
931static 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
959static void extract_channels_elixir(CBMExtractCtx *ctx) {
960 TSNodeStack stack;

Callers 1

extract_channels_elixirFunction · 0.85

Calls 4

cbm_node_textFunction · 0.85
literal_from_argFunction · 0.85
literal_from_first_childFunction · 0.85
push_channelFunction · 0.85

Tested by

no test coverage detected