Skip to content

Commit

Permalink
Fix variadic function arity missing & after emission
Browse files Browse the repository at this point in the history
  • Loading branch information
ggeoffrey committed Sep 1, 2022
1 parent 84f1354 commit 83b90b4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/hyperfiddle/rcf/analyzer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,10 @@
(case (:local ast)
:catch (:form ast)
(:let :letfn) [(:name ast) (emit (:init ast))]
(:fn :arg) (:name ast)))
:fn (:name ast)
:arg (if (:variadic? ast)
['& (:name ast)]
[(:name ast)])))

(defmethod -emit :quote [ast] (:form ast))

Expand All @@ -607,7 +610,7 @@
`(~'fn* ~@methods))))

(defmethod -emit :fn-method [ast]
(list (mapv emit (:params ast)) (emit (:body ast))))
(list (vec (mapcat emit (:params ast))) (emit (:body ast))))

(defmethod -emit :letfn [ast]
(list 'letfn* (vec (mapcat identity (mapv emit (:bindings ast)))) (emit (:body ast))))
Expand Down

0 comments on commit 83b90b4

Please sign in to comment.