File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 3483
3483
(contains? t 'js)
3484
3484
(some array-types t))))))
3485
3485
3486
+ (defn- analyze-js-star-args [js-op env args]
3487
+ (first (reduce
3488
+ (fn [[argexprs env] arg]
3489
+ [(conj argexprs (analyze env arg))
3490
+ (if (= js-op 'cljs.core/and)
3491
+ (set-test-induced-tags env arg)
3492
+ env)])
3493
+ [[] env]
3494
+ args)))
3495
+
3486
3496
(defn analyze-js-star* [env jsform args form]
3487
3497
(let [enve (assoc env :context :expr )
3488
- argexprs (vec (map #(analyze enve %) args))
3489
3498
form-meta (meta form)
3490
3499
segs (js-star-seg jsform)
3491
3500
tag (get-js-tag form)
3492
3501
js-op (:js-op form-meta)
3502
+ argexprs (analyze-js-star-args js-op enve args)
3493
3503
numeric (:numeric form-meta)
3494
3504
validate (fn [warning-type valid-types?]
3495
3505
(let [types (map #(infer-tag env %) argexprs)]
Original file line number Diff line number Diff line change 874
874
([x] x)
875
875
([x & next]
876
876
(core/let [forms (concat [x] next)]
877
- (if (every? #(simple-test-expr? &env %)
878
- (map #(cljs.analyzer/no-warn (cljs.analyzer/analyze &env %)) forms))
877
+ (core/cond
878
+ (every? #(simple-test-expr? &env %)
879
+ (map #(cljs.analyzer/no-warn (cljs.analyzer/analyze &env %)) forms))
879
880
(core/let [and-str (core/->> (repeat (count forms) " (~{})" )
880
881
(interpose " && " )
881
882
(#(concat [" (" ] % [" )" ]))
882
883
(apply core/str))]
883
884
(bool-expr `(~'js* ~and-str ~@forms)))
885
+
886
+ (typed-expr? &env x '#{boolean})
887
+ `(if ~x (and ~@next) false )
888
+
889
+ :else
884
890
`(let [and# ~x]
885
891
(if and# (and ~@next) and#))))))
886
892
You can’t perform that action at this time.
0 commit comments