Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Warn on invalid js forms. refs #455

  • Loading branch information...
commit b2df2c2a69a4f1c9be8d698b74122c98b1e22491 1 parent ea95d83
@jonase jonase authored swannodette committed
View
6 samples/twitterbuzz/src/twitterbuzz/anneal.cljs
@@ -9,13 +9,13 @@
(ns twitterbuzz.anneal)
(defn exp [x]
- (js/Math.exp x))
+ (.exp js/Math x))
(defn abs [x]
- (js/Math.abs x))
+ (.abs js/Math x))
(defn random []
- (js/Math.random))
+ (.random js/Math))
(defn standard-prob [e e1 temp]
(if (< e1 e)
View
2  samples/twitterbuzz/src/twitterbuzz/layout.cljs
@@ -18,7 +18,7 @@
(* x x))
(defn sqrt [x]
- (js/Math.sqrt x))
+ (.sqrt js/Math x))
(defn dist [{x1 :x y1 :y} {x2 :x y2 :y}]
(sqrt (+ (sqr (- x2 x1)) (sqr (- y2 y1)))))
View
2  samples/twitterbuzz/src/twitterbuzz/showgraph.cljs
@@ -45,7 +45,7 @@
(+ (* unit-arg (- canvas-size avatar-size)) (/ avatar-size 2)))
(defn log [& args]
- (js/console.log (apply pr-str args)))
+ (.log js/console (apply pr-str args)))
(def avatar-hover
(doto
View
4 src/clj/cljs/analyzer.clj
@@ -151,7 +151,9 @@
([env sym] (resolve-var env sym nil))
([env sym confirm]
(if (= (namespace sym) "js")
- {:name sym :ns 'js}
+ (do (when (some #{\.} (-> sym name str))
+ (warning env (str "Invalid js form " sym)))
+ {:name sym :ns 'js})
(let [s (str sym)
lb (-> env :locals sym)]
(cond
View
6 src/cljs/cljs/core.cljs
@@ -1800,7 +1800,7 @@ reduces them without incurring seq initialization"
([this coll not-found]
(get coll (.toString this) not-found))))
-(set! js/String.prototype.apply
+(set! (.-apply (.-prototype js/String))
(fn
[s args]
(if (< (count args) 2)
@@ -6025,7 +6025,7 @@ reduces them without incurring seq initialization"
(-count [rng]
(if-not (-seq rng)
0
- (js/Math.ceil (/ (- end start) step))))
+ (.ceil js/Math (/ (- end start) step))))
IIndexed
(-nth [rng n]
@@ -6049,7 +6049,7 @@ reduces them without incurring seq initialization"
"Returns a lazy seq of nums from start (inclusive) to end
(exclusive), by step, where start defaults to 0, step to 1,
and end to infinity."
- ([] (range 0 js/Number.MAX_VALUE 1))
+ ([] (range 0 (.-MAX_VALUE js/Number) 1))
([end] (range 0 end 1))
([start end] (range start end 1))
([start end step] (Range. nil start end step nil)))
Please sign in to comment.
Something went wrong with that request. Please try again.