Process a keyword argument (keyword_argument or pair node).
| 1315 | |
| 1316 | // Process a keyword argument (keyword_argument or pair node). |
| 1317 | static void process_keyword_arg(CBMExtractCtx *ctx, TSNode arg_node, CBMCallArg *ca) { |
| 1318 | TSNode key_n = ts_node_child_by_field_name(arg_node, TS_FIELD("name")); |
| 1319 | TSNode val_n = ts_node_child_by_field_name(arg_node, TS_FIELD("value")); |
| 1320 | if (ts_node_is_null(key_n)) { |
| 1321 | key_n = ts_node_child_by_field_name(arg_node, TS_FIELD("key")); |
| 1322 | } |
| 1323 | if (!ts_node_is_null(key_n)) { |
| 1324 | ca->keyword = cbm_node_text(ctx->arena, key_n, ctx->source); |
| 1325 | } |
| 1326 | if (!ts_node_is_null(val_n)) { |
| 1327 | ca->expr = cbm_node_text(ctx->arena, val_n, ctx->source); |
| 1328 | if (strcmp(ts_node_type(val_n), "identifier") == 0 && ca->expr) { |
| 1329 | ca->value = lookup_string_constant(ctx, ca->expr); |
| 1330 | } else if (is_string_like(ts_node_type(val_n)) && ca->expr) { |
| 1331 | ca->value = strip_quotes(ctx->arena, ca->expr); |
| 1332 | } |
| 1333 | } |
| 1334 | } |
| 1335 | |
| 1336 | /* Extract all arguments from a call expression into call->args[]. */ |
| 1337 | static void extract_call_args(CBMExtractCtx *ctx, TSNode args, CBMCall *call) { |
no test coverage detected