~technomancy/fennel

fennel: Add file name to source maps v1 APPLIED

~equa
~equa: 1
 Add file name to source maps

 1 files changed, 13 insertions(+), 8 deletions(-)
#411684 .build.yml failed
builds.sr.ht
fennel/patches/.build.yml: FAILED in 17s

[Add file name to source maps][0] from [~equa][1]

[0]: https://lists.sr.ht/~technomancy/fennel/patches/19908
[1]: mailto:equaa@protonmail.com

✗ #411684 FAILED fennel/patches/.build.yml https://builds.sr.ht/~technomancy/job/411684
~equa <equa@git.sr.ht> writes:
Next
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~technomancy/fennel/patches/19908/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH fennel 1/1] Add file name to source maps Export this patch

~equa
From: equa <equaa@protonmail.com>

This allows for proper line numbering when expanding macros, for
example, whereas previously tracebacks would produce the line number
of the macro source but the file name of the invocation.
---
 src/fennel/compiler.fnl | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/fennel/compiler.fnl b/src/fennel/compiler.fnl
index 09be556..4f66edb 100644
--- a/src/fennel/compiler.fnl
+++ b/src/fennel/compiler.fnl
@@ -260,7 +260,10 @@ Tab is what is used to indent a block."
      (let [code chunk.leaf
            info chunk.ast]
        (when sm
          (table.insert sm (or (and info info.line) (- 1))))
          (table.insert
            sm
            [(and info info.filename)
             (and info info.line)]))
        code)
      (let [tab (match tab
                  true "  " false "" tab tab nil "")]
@@ -293,8 +296,8 @@ Tab is what is used to indent a block."
        (let [sm []
              ret (flatten-chunk sm chunk options.indent 0)]
          (when sm
            (set sm.short_src (make-short-src (or options.filename
                                                  options.source ret)))
            (set sm.short_src (or options.filename
                                  (make-short-src (or options.source ret))))
            (set sm.key (if options.filename (.. "@" options.filename) ret))
            (tset fennel-sourcemap sm.key sm))
          (values ret sm)))))
@@ -777,16 +780,18 @@ which we have to do if we don't know."
      (let [remap (. fennel-sourcemap info.source)]
        (when (and remap (. remap info.currentline))
          ;; And some global info
          (set info.short-src remap.short-src)
          (set info.short_src
               (if (. remap info.currentline 1)
                   (. fennel-sourcemap (.. "@" (. remap info.currentline 1))
                      :short_src)
                   remap.short_src))
          ;; Overwrite info with values from the mapping
          ;; (mapping is now just integer, but may
          ;; eventually be a table)
          (set info.currentline (. remap info.currentline)))
          (set info.currentline (or (. remap info.currentline 2) -1)))
        (if (= info.what "Lua")
            (string.format "  %s:%d: in function %s"
                           info.short_src info.currentline
               (if info.name (.. "'" info.name "'") "?"))
            (= info.short-src "(tail call)")
            (= info.short_src "(tail call)")
            "  (tail call)"
            (string.format "  %s:%d: in main chunk"
                           info.short_src info.currentline)))))
-- 
2.26.2
builds.sr.ht
fennel/patches/.build.yml: FAILED in 17s

[Add file name to source maps][0] from [~equa][1]

[0]: https://lists.sr.ht/~technomancy/fennel/patches/19908
[1]: mailto:equaa@protonmail.com

✗ #411684 FAILED fennel/patches/.build.yml https://builds.sr.ht/~technomancy/job/411684
~equa <equa@git.sr.ht> writes: