1
0
mirror of https://github.com/janet-lang/janet synced 2025-12-16 21:48:06 +00:00

Save :source-form in environment when debugging is enabled.

This commit is contained in:
Calvin Rose
2024-08-29 21:03:25 -05:00
parent 43ecd4f2d8
commit 5a199716cb
5 changed files with 28 additions and 4 deletions

View File

@@ -39,6 +39,7 @@
(buffer/format buf "%j" (in args index))
(set index (+ index 1)))
(array/push modifiers (string buf ")\n\n" docstr))
(if (dyn :debug) (array/push modifiers {:source-form (dyn :macro-form)}))
# Build return value
~(def ,name ,;modifiers (fn ,name ,;(tuple/slice more start)))))
@@ -4654,6 +4655,9 @@
(put flat :doc nil))
(when (boot/config :no-sourcemaps)
(put flat :source-map nil))
(unless (v :private)
(unless (v :doc)
(errorf "no docs: %v %p" k v))) # make sure we have docs
# Fix directory separators on windows to make image identical between windows and non-windows
(when-let [sm (get flat :source-map)]
(put flat :source-map [(string/replace-all "\\" "/" (sm 0)) (sm 1) (sm 2)]))