Skip to content

Commit 07d2ebc

Browse files
authored
CLJS-3395: (set! a -x false) doesn't work (#205)
Count the forms, add runtime test case
1 parent 02b7ead commit 07d2ebc

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/main/clojure/cljs/analyzer.cljc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2604,7 +2604,7 @@
26042604

26052605
(defmethod parse 'set!
26062606
[_ env [_ target val alt :as form] _ _]
2607-
(let [[target val] (if alt
2607+
(let [[target val] (if (= 4 (count form))
26082608
;; (set! o -prop val)
26092609
[`(. ~target ~val) alt]
26102610
[target val])]

src/test/cljs/cljs/core_test.cljs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1987,3 +1987,9 @@
19871987
(testing "macroexpanding non-seqs should work"
19881988
(is (true? (macroexpand '(and))))
19891989
(is (nil? (macroexpand '(or))))))
1990+
1991+
(deftest test-cljs-3395
1992+
(testing "(set! foo -bar baz) pattern"
1993+
(let [a #js {}]
1994+
(set! a -x false)
1995+
(is (false? (.-x a))))))

0 commit comments

Comments
 (0)