The key of an object-literal pair as a plain name, or NULL. */
| 324 | |
| 325 | /* The key of an object-literal pair as a plain name, or NULL. */ |
| 326 | static const char *pair_key(CBMExtractCtx *ctx, TSNode pair) { |
| 327 | TSNode key = ts_node_child_by_field_name(pair, TS_FIELD("key")); |
| 328 | if (ts_node_is_null(key)) { |
| 329 | return NULL; |
| 330 | } |
| 331 | const char *k = ts_node_type(key); |
| 332 | if (strcmp(k, "property_identifier") == 0) { |
| 333 | return cbm_node_text(ctx->arena, key, ctx->source); |
| 334 | } |
| 335 | if (strcmp(k, "string") == 0) { |
| 336 | return fold_string_like(ctx, key, 0, false); |
| 337 | } |
| 338 | return NULL; |
| 339 | } |
| 340 | |
| 341 | static void record_object(CBMExtractCtx *ctx, const char *prefix, TSNode obj, int depth) { |
| 342 | uint32_t nc = ts_node_named_child_count(obj); |
no test coverage detected