Clojure `(ns app.core (:require [app.util :as u]) (:use app.io))` and Common * Lisp `(defpackage :main (:use :cl :util))` carry their dependency list inside * nested keyword clauses (`:require`/`:use`/`:import`). Walk such a clause and * push each referenced module/package as an import. `clause` is the * `(:require ...)` / `(:use ...)` list. */
| 1693 | * push each referenced module/package as an import. `clause` is the |
| 1694 | * `(:require ...)` / `(:use ...)` list. */ |
| 1695 | static void lisp_push_clause_modules(CBMExtractCtx *ctx, TSNode clause) { |
| 1696 | uint32_t cc = ts_node_named_child_count(clause); |
| 1697 | for (uint32_t j = 1; j < cc; j++) { /* skip the leading keyword head */ |
| 1698 | TSNode item = ts_node_named_child(clause, j); |
| 1699 | const char *ik = ts_node_type(item); |
| 1700 | /* `[app.util :as u]` — the module is the vector's first symbol. */ |
| 1701 | if (strcmp(ik, "vec_lit") == 0 || strcmp(ik, "list_lit") == 0 || strcmp(ik, "list") == 0) { |
| 1702 | uint32_t vc = ts_node_named_child_count(item); |
| 1703 | if (vc > 0) { |
| 1704 | lisp_push_module(ctx, ts_node_named_child(item, 0)); |
| 1705 | } |
| 1706 | } else { |
| 1707 | /* bare symbol/keyword: `:util`, `app.io`. */ |
| 1708 | lisp_push_module(ctx, item); |
| 1709 | } |
| 1710 | } |
| 1711 | } |
| 1712 | |
| 1713 | /* The s-expression head symbol text, or NULL if the list has no symbol head. */ |
| 1714 | static char *lisp_head_text(CBMExtractCtx *ctx, TSNode list, TSNode *out_head) { |
no test coverage detected