8000 fix compiling stdin not working · repos-javascript-compilers/wisp@35cdbcc · GitHub
[go: up one dir, main page]

Skip to content {"props":{"docsUrl":"https://docs.github.com/get-started/accessibility/keyboard-shortcuts"}}

Commit 35cdbcc

Browse files
committed
fix compiling stdin not working
1 parent 607877b commit 35cdbcc

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/wisp.wisp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020
[options]
2121
(with-stream-content process.stdin
2222
compile-string
23-
options))
23+
(conj {} options)))
24+
;; (conj {:source-uri options}) causes segfault for some reason
2425

2526
(defn compile-file
2627
[path options]
@@ -33,13 +34,12 @@
3334
[source options]
3435
(let [channel (or (:print options) :code)
3536
output (compile source options)
36-
content (if (= channel :code)
37-
(:code output)
38-
(JSON.stringify (get output channel) 2 2))]
39-
(if (:ast options) (map (fn [item]
40-
(.write process.stdout
41-
(str (pr-str item.form) "\n")))
42-
output.ast))
37+
content (cond
38+
(= channel :code) (:code output)
39+
(= channel :forms) (map (fn [item]
40+
(str (pr-str (:form item)) "\n"))
41+
(:ast output))
42+
:else (pr-str (get output channel) 2 2))]
4343
(if (and (:output options) (:source-uri options) content)
4444
(writeFileSync (path.join (:output options) ;; `join` relies on `path`
4545
(str (basename (:source-uri options) ".wisp") ".js"))

0 commit comments

Comments
 (0)
0