Skip to content
Browse files

print records with correct namespace

  • Loading branch information...
1 parent 17f9c53 commit 8aa0cd7a0ba3f8466fcde83558ce83f275b61b32 @thheller thheller committed with swannodette Feb 12, 2013
Showing with 3 additions and 2 deletions.
  1. +2 −1 src/clj/cljs/core.clj
  2. +1 −1 test/cljs/cljs/core_test.cljs
View
3 src/clj/cljs/core.clj
@@ -662,6 +662,7 @@
(let [hinted-fields fields
fields (vec (map #(with-meta % nil) fields))
base-fields fields
+ pr-open (core/str "#" (.getNamespace rname) "." (.getName rname) "{")
fields (conj fields '__meta '__extmap (with-meta '__hash {:mutable true}))]
(let [gs (gensym)
ksym (gensym "k")
@@ -718,7 +719,7 @@
`(~'-pr-writer [this# writer# opts#]
(let [pr-pair# (fn [keyval#] (pr-sequential-writer writer# pr-writer "" " " "" opts# keyval#))]
(pr-sequential-writer
- writer# pr-pair# (core/str "#" ~(name rname) "{") ", " "}" opts#
+ writer# pr-pair# ~pr-open ", " "}" opts#
(concat [~@(map #(list `vector (keyword %) %) base-fields)]
~'__extmap))))
])
View
2 test/cljs/cljs/core_test.cljs
@@ -1730,7 +1730,7 @@
;;; pr-str records
(defrecord PrintMe [a b])
- (assert (= (pr-str (PrintMe. 1 2)) "#PrintMe{:a 1, :b 2}"))
+ (assert (= (pr-str (PrintMe. 1 2)) "#cljs.core-test.PrintMe{:a 1, :b 2}"))
;;; pr-str inst

0 comments on commit 8aa0cd7

Please sign in to comment.
Something went wrong with that request. Please try again.