feat: java.io.File model + multimethod/assoc/defmulti fixes for migratus (jolt-hjw)
File API (jolt-hjw): io/file and (File. …) build a tagged :jolt/file value (instance? File true) with a full method surface (isFile/isDirectory/exists/ getName/getPath/getAbsolutePath/listFiles/toPath/delete/createNewFile/…) backed by os/ and file/. file-seq is File-aware (leaves are File values). str/slurp/spit coerce :jolt/file to its path. ClassLoader/getSystemClassLoader + a classloader stub whose getResource returns nil degrade migratus's classpath lookup to the filesystem. java.nio.file Path/FileSystem/PathMatcher are shimmed just enough for script-excluded?'s glob (recursive * / ? matcher). Three bugs found getting migratus's migration discovery to work: - (assoc nil k v) returned a raw janet table, not a map, so assoc-in built tables that count/seq rejected. Now returns an immutable map. - methods/get-method resolved the multimethod symbol at runtime in the current ns, so a bare multifn ref in its defining ns saw an empty table once defmethods lived elsewhere. Now they take the multimethod VALUE and recover the var via a registry (Clojure semantics). - defmulti now drops a leading docstring/attr-map (migratus's multimethods carry docstrings) instead of treating the docstring as the dispatch fn. Conformance 335/335 x3, clojure-test-suite at baseline.
This commit is contained in:
parent
9813186ef9
commit
b304c43333
6 changed files with 164 additions and 19 deletions
|
|
@ -519,7 +519,11 @@
|
|||
;; via the host dir primitives. Paths (strings), not File objects. (Lives below
|
||||
;; tree-seq: forward references are analysis errors now — jolt-2o7.3.)
|
||||
(defn file-seq [root]
|
||||
(tree-seq __dir? __list-dir root))
|
||||
(if (__file? root)
|
||||
;; java.io.File tree: walk via the File method surface so leaves are File
|
||||
;; values callers can invoke .isFile/.getName/slurp on (jolt-hjw).
|
||||
(tree-seq (fn [f] (.isDirectory f)) (fn [f] (seq (.listFiles f))) root)
|
||||
(tree-seq __dir? __list-dir root)))
|
||||
|
||||
;; Canonical flatten via tree-seq: the leaves (non-sequential nodes) in order.
|
||||
;; Flattens lists too (sequential?), matching Clojure/CLJS.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue