bunch of small changes

This commit is contained in:
XeroOl 2024-06-15 22:32:46 -05:00
parent 5875205899
commit 664ba9b13d
5 changed files with 11 additions and 16 deletions

View File

@ -31,10 +31,10 @@
(λ main-loop [in out]
(local send (partial json-rpc.write out))
(local state [])
(local server {})
(while true
(let [msg (json-rpc.read in)]
(dispatch.handle state send msg))))
(dispatch.handle server send msg))))
(λ main []
(case arg

View File

@ -18,7 +18,7 @@ in the \"server\" object."
(let [body (file:read :*a)]
(file:close)
body)
(error (.. "failed to open file" uri)))))]
(error (.. "failed to open file " uri)))))]
{: uri : text}))
(λ get-by-uri [server uri]

View File

@ -36,6 +36,11 @@
"(let [x 0]
(print x))"))
(fn test-fix-unused-definition []
(check "(local x==== 10)"
"unused-definition"
"(local _x 10)"))
; (fn test-fix-method-function []
; (check "(local x {})
; (fn x:y [a b c]
@ -45,4 +50,5 @@
; (fn x.y [client a b c]
; (print client a b c))"))
{: test-fix-op-no-arguments}
{: test-fix-op-no-arguments
: test-fix-unused-definition}

View File

@ -1,14 +1,3 @@
(local fennel (require :fennel))
(set debug.traceback fennel.traceback)
(local old-debug-getinfo debug.getinfo)
(fn debug.getinfo [x]
(let [{: sourcemap} (require :fennel.compiler)
info (old-debug-getinfo (+ 1 x))]
(when info
(set info.currentline (or (?. sourcemap info.source info.currentline 2) info.currentline))
(set info.linedefined (or (?. sourcemap info.source info.linedefined 2) info.linedefined)))
info))
(local faith (require :faith))
(faith.run

View File

@ -15,6 +15,6 @@
"'")))
" ")]
(print (.. "running command: " command))
(os.execute command)))
(assert (os.execute command))))
{: sh}