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
|
## 1.1.2-SNAPSHOT
|
||||||
|
|
||||||
* Eliminate reflection warning
|
* 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
|
## 1.1.1 - 2018-04-23
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -166,7 +166,10 @@
|
||||||
embed (i/maybe-direct-nav path (-> s meta :direct-nav))]
|
embed (i/maybe-direct-nav path (-> s meta :direct-nav))]
|
||||||
`(com.rpl.specter.impl/->LocalSym ~path (quote ~embed)))
|
`(com.rpl.specter.impl/->LocalSym ~path (quote ~embed)))
|
||||||
;; var-get doesn't work in cljs, so capture the val in the macro instead
|
;; 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)
|
(i/fn-invocation? path)
|
||||||
|
|
|
||||||
|
|
@ -702,16 +702,18 @@
|
||||||
(preserve-map magic-precompilation* o)
|
(preserve-map magic-precompilation* o)
|
||||||
|
|
||||||
(instance? VarUse o)
|
(instance? VarUse o)
|
||||||
(if (dynamic-var? (:avar o))
|
(let [v (:avar o)]
|
||||||
(->DynamicVal (maybe-direct-nav
|
;; v can be nil if the symbol referred to an imported class
|
||||||
(:sym o)
|
(if (and v (dynamic-var? v))
|
||||||
(or (-> o :avar direct-nav?)
|
(->DynamicVal (maybe-direct-nav
|
||||||
(-> o :sym direct-nav?))))
|
(:sym o)
|
||||||
(maybe-direct-nav
|
(or (direct-nav? v)
|
||||||
(:val o)
|
(-> o :sym direct-nav?))))
|
||||||
(or (-> o :avar direct-nav?)
|
(maybe-direct-nav
|
||||||
(-> o :sym direct-nav?)
|
(:val o)
|
||||||
(-> o :val direct-nav?))))
|
(or (and v (direct-nav? v))
|
||||||
|
(-> o :sym direct-nav?)
|
||||||
|
(-> o :val direct-nav?)))))
|
||||||
|
|
||||||
(instance? LocalSym o)
|
(instance? LocalSym o)
|
||||||
(->DynamicVal (:sym o))
|
(->DynamicVal (:sym o))
|
||||||
|
|
|
||||||
|
|
@ -1679,6 +1679,12 @@
|
||||||
{:a [{:b 2 :c 1}]}])))
|
{: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
|
#?(:clj
|
||||||
(do
|
(do
|
||||||
(defprotocolpath FooPP)
|
(defprotocolpath FooPP)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue