Fix bug in let's handle-dot.

This commit is contained in:
gilch 2018-05-02 19:50:43 -06:00 committed by Kodi Arfer
parent 60c0f60a32
commit 049c78f5d5
2 changed files with 10 additions and 3 deletions

View File

@ -136,12 +136,14 @@ Arguments without a header are under None.
:quote-level (+ self.quote-level x))))
(defn handle-dot [self]
`(. ~@(walk (fn [form]
`(. ~(self.expand-symbols (first (self.tail)))
~@(walk (fn [form]
(if (symbol? form)
form ; don't expand attrs
(self.expand-symbols form)))
identity
(self.tail))))
(cut (self.tail)
1))))
(defn head [self]
(first self.form))

View File

@ -227,7 +227,12 @@
(setv foo (fn [])
foo.a 42)
(let [a 1
b []]
b []
bar (fn [])]
(setv bar.a 13)
(assert (= bar.a 13))
(setv (. bar a) 14)
(assert (= bar.a 14))
(assert (= a 1))
(assert (= b []))
;; method syntax not affected