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

Function lisp_head_is_def

internal/cbm/extract_unified.c:482–512  ·  view source on GitHub ↗

True for a Lisp def-form head symbol (defn/define/...). Mirrors * lisp_is_def_head() in extract_defs.c so the scope-stack walk pushes a * SCOPE_FUNC only for actual definitions, never for a plain call list such as * `(add x 1)` — otherwise every parenthesized form would shadow the enclosing * def and the in-body call would mis-source. */

Source from the content-addressed store, hash-verified

480 * `(add x 1)` — otherwise every parenthesized form would shadow the enclosing
481 * def and the in-body call would mis-source. */
482static bool lisp_head_is_def(const char *t) {
483 if (!t) {
484 return false;
485 }
486 static const char *heads[] = {"defn",
487 "defn-",
488 "def",
489 "defmacro",
490 "defmulti",
491 "defmethod",
492 "defprotocol",
493 "defrecord",
494 "deftype",
495 "definterface",
496 "defonce",
497 "define",
498 "define-syntax",
499 "define-values",
500 "define-syntax-rule",
501 "define-struct",
502 "define-record-type",
503 "define/contract",
504 "struct",
505 NULL};
506 for (int i = 0; heads[i]; i++) {
507 if (strcmp(t, heads[i]) == 0) {
508 return true;
509 }
510 }
511 return false;
512}
513
514/* Resolve a Lisp (Clojure/Scheme/Racket) def-form's QN for scope tracking.
515 * The def node is a list/list_lit whose head names the def kind and whose

Callers 1

compute_lisp_func_qnFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected