The `function` / `const` keyword of a use: an anonymous direct child of the * declaration (flat form) or of one clause (grouped form * `use A\{function f, const C, K}`). `fallback` when neither is present. * Mirrors the extractor's php_use_kind (extract_imports.c). */
| 2817 | * `use A\{function f, const C, K}`). `fallback` when neither is present. |
| 2818 | * Mirrors the extractor's php_use_kind (extract_imports.c). */ |
| 2819 | static int php_use_keyword_kind(TSNode node, int fallback) { |
| 2820 | uint32_t n = ts_node_child_count(node); |
| 2821 | for (uint32_t i = 0; i < n; i++) { |
| 2822 | TSNode c = ts_node_child(node, i); |
| 2823 | if (ts_node_is_null(c) || ts_node_is_named(c)) |
| 2824 | continue; |
| 2825 | const char *k = ts_node_type(c); |
| 2826 | if (strcmp(k, "function") == 0) |
| 2827 | return CBM_PHP_USE_FUNCTION; |
| 2828 | if (strcmp(k, "const") == 0) |
| 2829 | return CBM_PHP_USE_CONST; |
| 2830 | } |
| 2831 | return fallback; |
| 2832 | } |
| 2833 | |
| 2834 | static void collect_use_declaration(PHPLSPContext *ctx, TSNode use_decl) { |
| 2835 | /* Determine kind: function / const / class (default). */ |
no outgoing calls
no test coverage detected