File tree Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Expand file tree Collapse file tree 2 files changed +12
-6
lines changed Original file line number Diff line number Diff line change @@ -9606,15 +9606,17 @@ reduces them without incurring seq initialization"
9606
9606
(regexp? obj) (write-all writer " #\" " (.-source obj) " \" " )
9607
9607
9608
9608
:else
9609
- (if (.. obj -constructor -cljs$lang$ctorStr)
9609
+ (if (some-> obj . -constructor . -cljs$lang$ctorStr)
9610
9610
(write-all writer
9611
9611
" #object[" (.replace (.. obj -constructor -cljs$lang$ctorStr)
9612
9612
(js/RegExp. " /" " g" ) " ." ) " ]" )
9613
- (let [name (.. obj -constructor -name)
9614
- name (if (or (nil? name) (gstring/isEmpty name))
9615
- " Object"
9616
- name)]
9617
- (write-all writer " #object[" name " " (str obj) " ]" )))))))
9613
+ (let [name (some-> obj .-constructor .-name)
9614
+ name (if (or (nil? name) (gstring/isEmpty name))
9615
+ " Object"
9616
+ name)]
9617
+ (if (nil? (. obj -constructor))
9618
+ (write-all writer " #object[" name " ]" )
9619
+ (write-all writer " #object[" name " " (str obj) " ]" ))))))))
9618
9620
9619
9621
(defn- pr-writer
9620
9622
" Prefer this to pr-seq, because it makes the printing function
Original file line number Diff line number Diff line change 1359
1359
(testing " Resolve should return valid var"
1360
1360
(is (= 1 ((resolve 'first) [1 2 3 ])))))
1361
1361
1362
+ (deftest test-cljs-1998
1363
+ (testing " printing an Object with a null constructor"
1364
+ (is (= " #object[Object]" (pr-str (.create js/Object nil ))))))
1365
+
1362
1366
(comment
1363
1367
; ; ObjMap
1364
1368
; ; (let [ks (map (partial str "foo") (range 500))
You can’t perform that action at this time.
0 commit comments