Fix inline compiler symbol handling so class references can be used as constants within paths
This commit is contained in:
parent
798cda211f
commit
350c8b857f
4 changed files with 23 additions and 11 deletions
|
|
@ -1,6 +1,7 @@
|
|||
## 1.1.2-SNAPSHOT
|
||||
|
||||
* Eliminate reflection warning
|
||||
* Bug fix: Fix inline compiler symbol handling so class references can be used as constants within paths
|
||||
|
||||
## 1.1.1 - 2018-04-23
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,10 @@
|
|||
embed (i/maybe-direct-nav path (-> s meta :direct-nav))]
|
||||
`(com.rpl.specter.impl/->LocalSym ~path (quote ~embed)))
|
||||
;; var-get doesn't work in cljs, so capture the val in the macro instead
|
||||
`(com.rpl.specter.impl/->VarUse ~path (var ~path) (quote ~path)))
|
||||
`(com.rpl.specter.impl/->VarUse
|
||||
~path
|
||||
~(if-not (instance? Class (resolve path)) `(var ~path))
|
||||
(quote ~path)))
|
||||
|
||||
|
||||
(i/fn-invocation? path)
|
||||
|
|
|
|||
|
|
@ -702,16 +702,18 @@
|
|||
(preserve-map magic-precompilation* o)
|
||||
|
||||
(instance? VarUse o)
|
||||
(if (dynamic-var? (:avar o))
|
||||
(->DynamicVal (maybe-direct-nav
|
||||
(:sym o)
|
||||
(or (-> o :avar direct-nav?)
|
||||
(-> o :sym direct-nav?))))
|
||||
(maybe-direct-nav
|
||||
(:val o)
|
||||
(or (-> o :avar direct-nav?)
|
||||
(-> o :sym direct-nav?)
|
||||
(-> o :val direct-nav?))))
|
||||
(let [v (:avar o)]
|
||||
;; v can be nil if the symbol referred to an imported class
|
||||
(if (and v (dynamic-var? v))
|
||||
(->DynamicVal (maybe-direct-nav
|
||||
(:sym o)
|
||||
(or (direct-nav? v)
|
||||
(-> o :sym direct-nav?))))
|
||||
(maybe-direct-nav
|
||||
(:val o)
|
||||
(or (and v (direct-nav? v))
|
||||
(-> o :sym direct-nav?)
|
||||
(-> o :val direct-nav?)))))
|
||||
|
||||
(instance? LocalSym o)
|
||||
(->DynamicVal (:sym o))
|
||||
|
|
|
|||
|
|
@ -1679,6 +1679,12 @@
|
|||
{:a [{:b 2 :c 1}]}])))
|
||||
)
|
||||
|
||||
#?(:clj
|
||||
(deftest class-constant-test
|
||||
(let [f (fn [p] (fn [v] (str p (inc v))))]
|
||||
(is (= (str String 2) (multi-transform (s/terminal (f String)) 1)))
|
||||
)))
|
||||
|
||||
#?(:clj
|
||||
(do
|
||||
(defprotocolpath FooPP)
|
||||
|
|
|
|||
Loading…
Reference in a new issue