Auto-resolve ::keywords; honor clojure.edn reader opts
The reader dropped the namespace on ::kw (read ::foo as :foo), so auto-resolved keywords never matched their qualified form — code that round-trips them (spec keys, aero's :aero.core/* expansion keys) silently broke. Resolve ::name against the current ns and ::alias/name through the alias table, as Clojure does. The runtime loader reads form-by-form with the ns set after the ns form; the cross-compile reads all forms up front, so ei-emit-ns*/ei-emit-ns-records set the ns before reading. clojure.edn/read over a reader discarded its opts map — :readers/:default/:eof were ignored, so a custom :default never saw the tag. Route the reader arity through read-string so opts apply, and pass the tag to :default as a symbol (not the internal :#name keyword), matching Clojure. Seed re-minted (the ::halt transducer key in clojure.core now reads as :clojure.core/halt). Corpus gains ::-keyword rows; the unit case that asserted the old ns-dropping behavior now asserts the qualified result.
This commit is contained in:
parent
53b1c79d99
commit
6d56982abe
7 changed files with 31 additions and 12 deletions
|
|
@ -64,12 +64,14 @@
|
|||
;; realized? reads :jolt/type and throws on a jolt-lazyseq record.
|
||||
((jolt-lazyseq? x) (jolt-lazyseq-realized? x))
|
||||
(else (jolt-invoke overlay-realized? x))))))
|
||||
;; clojure.edn/read over a reader: the overlay edn.clj drain-reader reads
|
||||
;; :jolt/type; the native version (io.ss) drains the jhost reader instead.
|
||||
;; clojure.edn/read over a reader: drain the jhost reader, then read through the
|
||||
;; overlay read-string so the opts map (:readers/:default/:eof) is honored.
|
||||
(def-var! "clojure.edn" "read"
|
||||
(case-lambda
|
||||
((reader) (chez-edn-read reader))
|
||||
((opts reader) (chez-edn-read reader))))
|
||||
((opts reader)
|
||||
(jolt-invoke (var-deref "clojure.edn" "read-string") opts
|
||||
(if (reader-jhost? reader) (drain-reader reader) (jolt-str-render-one reader))))))
|
||||
;; line-seq: a jhost reader (io/reader result) -> drain+split; a map-reader (the
|
||||
;; overlay's :read-line-fn model, e.g. with-in-str) -> the overlay version.
|
||||
(let ((overlay-line-seq (var-deref "clojure.core" "line-seq")))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue