File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change 3406
3406
:children items
3407
3407
:tag (if (map? val) 'object 'array)}))
3408
3408
3409
+ (defn analyze-record
3410
+ [env x]
3411
+ (let [items (disallowing-recur
3412
+ (analyze (assoc env :context :expr ) (into {} x)))
3413
+ [ns name] (map symbol
3414
+ #?(:clj
3415
+ ((juxt (comp #(string/join " ." %) butlast) last)
3416
+ (string/split (.getName ^Class (type x)) #"\. " ))
3417
+ :cljs
3418
+ (string/split (pr-str (type x)) #"/" )))]
3419
+ {:op :record-value
3420
+ :ns ns
3421
+ :name name
3422
+ :env env
3423
+ :form x
3424
+ :items items
3425
+ :children [items]
3426
+ :tag name}))
3427
+
3409
3428
(defn elide-reader-meta [m]
3410
3429
(dissoc m :file :line :column :end-column :end-line :source ))
3411
3430
3509
3528
(cond
3510
3529
(symbol? form) (analyze-symbol env form)
3511
3530
(and (seq? form) (seq form)) (analyze-seq env form name opts)
3531
+ (record? form) (analyze-record env form)
3512
3532
(map? form) (analyze-map env form)
3513
3533
(vector? form) (analyze-vector env form)
3514
3534
(set? form) (analyze-set env form)
3530
3550
(cond
3531
3551
(symbol? form) (analyze-symbol env form)
3532
3552
(and (cljs-seq? form) (some? (seq form))) (analyze-seq env form name opts)
3553
+ (record? form) (analyze-record env form)
3533
3554
(cljs-map? form) (analyze-map env form)
3534
3555
(cljs-vector? form) (analyze-vector env form)
3535
3556
(cljs-set? form) (analyze-set env form)
Original file line number Diff line number Diff line change 460
460
(emits " })" ))
461
461
(emits " [" (comma-sep items) " ]" ))))
462
462
463
+ (defmethod emit* :record-value
464
+ [{:keys [items ns name items env]}]
465
+ (emit-wrap env
466
+ (emits ns " .map__GT_" name " (" items " )" )))
467
+
463
468
(defmethod emit* :constant
464
469
[{:keys [form env]}]
465
470
(when-not (= :statement (:context env))
Original file line number Diff line number Diff line change 398
398
(build/build (build/inputs (io/file inputs " data_readers_test" )) opts cenv)
399
399
(is (contains? (-> @cenv ::ana/data-readers ) 'test/custom-identity))))
400
400
401
+ (comment
402
+ (let [out " out"
403
+ {:keys [inputs opts]} {:inputs (str (io/file " src" " test" " cljs" ))
404
+ :opts {:main 'data-readers-test.records
405
+ :output-dir out
406
+ :optimizations :none
407
+ :closure-warnings {:check-types :off }}}
408
+ cenv (env/default-compiler-env )]
409
+ (build/build (build/inputs (io/file inputs " data_readers_test" )) opts cenv))
410
+ )
411
+
401
412
(deftest test-cljs-2249
402
413
(let [out (io/file (test/tmp-dir ) " cljs-2249-out" )
403
414
root (io/file " src" " test" " cljs_build" )
You can’t perform that action at this time.
0 commit comments