flan/test/programs/macro-loc-literal.flan

20 lines
711 B
Plaintext

;;;; A number a macro passed through is reported at the form around it.
;;;;
;;;; A Form on the wire carries a pointer for a name, a string and a bracket,
;;;; and that pointer is how a form that went into a macro is recognised when
;;;; it comes back out. An integer has no pointer -- its payload is the value
;;;; -- so the 5 below has nothing to be recognised by and takes the location
;;;; of the (g ...) around it, which does. So the error lands on the line the
;;;; call opens on rather than the line the number is on, and the two are kept
;;;; apart below so that the difference is visible.
(defmacro thru [& body]
`(do ~@body))
(defn g [s str] i32 0)
(defn main [] i32
(thru
(g
5))
0)