From aaf5d6297e8230b1494a4d5c829ead1d842014d2 Mon Sep 17 00:00:00 2001 From: Brandon Bloom Date: Tue, 5 Jun 2012 22:04:59 -0700 Subject: [PATCH 1/3] .getTime does not take arguments --- src/clj/cljs/core.clj | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/clj/cljs/core.clj b/src/clj/cljs/core.clj index 70c1509..b5d6e01 100644 --- a/src/clj/cljs/core.clj +++ b/src/clj/cljs/core.clj @@ -993,9 +993,9 @@ (defmacro time "Evaluates expr and prints the time it took. Returns the value of expr." [expr] - `(let [start# (.getTime (js/Date.) ()) + `(let [start# (.getTime (js/Date.)) ret# ~expr] - (prn (core/str "Elapsed time: " (- (.getTime (js/Date.) ()) start#) " msecs")) + (prn (core/str "Elapsed time: " (- (.getTime (js/Date.)) start#) " msecs")) ret#)) (defmacro simple-benchmark @@ -1041,4 +1041,4 @@ (if (zero? ~'argc) (~'f) ~(gen-apply-to-helper)))) - (set! ~'*unchecked-if* false))) \ No newline at end of file + (set! ~'*unchecked-if* false))) -- 1.7.9.1 From ad9a063f467c55a28ea3e565bdef3385f6f62759 Mon Sep 17 00:00:00 2001 From: Brandon Bloom Date: Sun, 17 Jun 2012 14:21:17 -0700 Subject: [PATCH 2/3] Move instance? up to fundamentals --- src/cljs/cljs/core.cljs | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/cljs/cljs/core.cljs b/src/cljs/cljs/core.cljs index cbea7d9..a8a88b2 100644 --- a/src/cljs/cljs/core.cljs +++ b/src/cljs/cljs/core.cljs @@ -308,6 +308,9 @@ (when-not (nil? x) (.-constructor x))) +(defn ^boolean instance? [t o] + (js* "(~{o} instanceof ~{t})")) + ;;;;;;;;;;;;;;;;;;; protocols on primitives ;;;;;;;; (declare hash-map list equiv-sequential) @@ -952,9 +955,6 @@ reduces them without incurring seq initialization" (defn ^boolean undefined? [x] (cljs.core/undefined? x)) -(defn ^boolean instance? [t o] - (js* "(~{o} instanceof ~{t})")) - (defn ^boolean seq? "Return true if s satisfies ISeq" [s] -- 1.7.9.1 From e2f00b115d19b77bd2f62c0c9602e5176eef1c92 Mon Sep 17 00:00:00 2001 From: Brandon Bloom Date: Sun, 17 Jun 2012 14:21:47 -0700 Subject: [PATCH 3/3] Fix (= (js/Date.) nil --- src/cljs/cljs/core.cljs | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/src/cljs/cljs/core.cljs b/src/cljs/cljs/core.cljs index a8a88b2..157fddb 100644 --- a/src/cljs/cljs/core.cljs +++ b/src/cljs/cljs/core.cljs @@ -376,7 +376,9 @@ (extend-type js/Date IEquiv - (-equiv [o other] (identical? (. o (toString)) (. other (toString))))) + (-equiv [o other] + (and (instance? js/Date other) + (identical? (.toString o) (.toString other))))) (extend-type number IEquiv -- 1.7.9.1