Skip to content

Commit

Permalink
[new] get-source: support form meta arg
Browse files Browse the repository at this point in the history
  • Loading branch information
ptaoussanis committed Aug 27, 2024
1 parent 18f96fe commit 7f9a986
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/taoensso/encore.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -1167,8 +1167,12 @@
"Returns {:keys [ns line column file]} source location given a macro's
compile-time `&form` and `&env` vals. See also `keep-callsite`."
{:added "Encore v3.61.0 (2023-07-07)"}
[macro-form macro-env]
(let [{:keys [line column file]} (meta macro-form)
[macro-form-or-meta macro-env]
(let [{:keys [line column file]}
(if (map? macro-form-or-meta)
(do macro-form-or-meta)
(meta macro-form-or-meta))

file
(if-not (:ns macro-env)
*file* ; Compiling clj
Expand Down

0 comments on commit 7f9a986

Please sign in to comment.