Fix emit-quote-expr: use raw-form->janet instead of re-analyzing
quote expressions were returning AST structs instead of the actual quoted values through compile-ast. Added raw-form->janet converter that passes Jolt reader forms through verbatim to Janet's quote special form.
This commit is contained in:
parent
d1442ce925
commit
4a962cf6f3
1 changed files with 13 additions and 1 deletions
|
|
@ -670,8 +670,20 @@
|
|||
|
||||
(defn- emit-map-expr [form] form)
|
||||
|
||||
(defn- raw-form->janet
|
||||
"Convert a Jolt reader form to a Janet data structure for quoting."
|
||||
[form]
|
||||
(cond
|
||||
(and (struct? form) (= :symbol (form :jolt/type)))
|
||||
(symbol (form :name))
|
||||
(array? form)
|
||||
(tuple/slice (tuple ;(map raw-form->janet form)))
|
||||
(tuple? form)
|
||||
(tuple/slice (tuple ;(map raw-form->janet form)))
|
||||
form))
|
||||
|
||||
(defn- emit-quote-expr [expr]
|
||||
['quote (analyze-form expr @{})])
|
||||
['quote (raw-form->janet expr)])
|
||||
|
||||
(set emit-expr
|
||||
(fn [ast]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue