Skip to content

Commit 5477284

Browse files
committed
* if Long beyond bounds of JS integral values, emit BigInt
1 parent 7828149 commit 5477284

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/main/clojure/cljs/compiler.cljc

+5-1
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,11 @@
313313
(defmethod emit-constant* nil [x] (emits "null"))
314314

315315
#?(:clj
316-
(defmethod emit-constant* Long [x] (emits "(" x ")")))
316+
(defmethod emit-constant* Long [x]
317+
(if (or (> x 9007199254740991)
318+
(< x -9007199254740991))
319+
(emits "(" x "n)")
320+
(emits "(" x ")"))))
317321

318322
#?(:clj
319323
(defmethod emit-constant* Integer [x] (emits x))) ; reader puts Integers in metadata

0 commit comments

Comments
 (0)