From 5477284edf6456e7254d139255d074bb2d087a75 Mon Sep 17 00:00:00 2001 From: davidnolen Date: Mon, 25 Sep 2023 20:39:50 -0400 Subject: [PATCH] * if Long beyond bounds of JS integral values, emit BigInt --- src/main/clojure/cljs/compiler.cljc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/clojure/cljs/compiler.cljc b/src/main/clojure/cljs/compiler.cljc index 2ef7c8c76..579fba962 100644 --- a/src/main/clojure/cljs/compiler.cljc +++ b/src/main/clojure/cljs/compiler.cljc @@ -313,7 +313,11 @@ (defmethod emit-constant* nil [x] (emits "null")) #?(:clj - (defmethod emit-constant* Long [x] (emits "(" x ")"))) + (defmethod emit-constant* Long [x] + (if (or (> x 9007199254740991) + (< x -9007199254740991)) + (emits "(" x "n)") + (emits "(" x ")")))) #?(:clj (defmethod emit-constant* Integer [x] (emits x))) ; reader puts Integers in metadata