Remove dead code

This commit is contained in:
Tommi Reiman 2019-02-08 19:22:30 +02:00
parent 54d5550fae
commit c302f795ab

View file

@ -116,23 +116,10 @@
(update :children dissoc "")) (update :children dissoc ""))
node'))) node')))
(defn decode! #?(:cljs
([path start end] (defn decode! [path start end percent?]
#?(:clj (let [s (subs path start end)] (let [path (subs path start end)]
(if (str/index-of s \%) (if percent? (js/decodeURIComponent path) path))))
(URLDecoder/decode
(if (str/index-of s \+) (.replace ^String s "+" "%2B") s)
"UTF-8")
s))
:cljs (js/decodeURIComponent (subs path start end))))
([path start end percent? plus?]
#?(:clj (let [s (String. ^chars path ^int start ^int (- end start))]
(if percent?
(URLDecoder/decode
(if plus? (.replace ^String s "+" "%2B") s)
"UTF-8")
s))
:cljs (js/decodeURIComponent (subs path start end)))))
(defn data-matcher [data] (defn data-matcher [data]
#?(:clj (Trie/dataMatcher data) #?(:clj (Trie/dataMatcher data)
@ -163,17 +150,16 @@
:cljs (reify Matcher :cljs (reify Matcher
(match [_ i max path] (match [_ i max path]
(if (and (< i max) (not= (get path i) \/)) (if (and (< i max) (not= (get path i) \/))
(loop [percent? false, plus? false, j i] (loop [percent? false, j i]
(if (= max j) (if (= max j)
(if-let [match (match matcher max max path)] (if-let [match (match matcher max max path)]
(-assoc! match key (decode! path i max percent? plus?))) (-assoc! match key (decode! path i max percent?)))
(let [c ^char (get path j)] (let [c ^char (get path j)]
(case c (case c
\/ (if-let [match (match matcher j max path)] \/ (if-let [match (match matcher j max path)]
(-assoc! match key (decode! path i j percent? plus?))) (-assoc! match key (decode! path i j percent?)))
\% (recur true plus? (inc j)) \% (recur true (inc j))
\+ (recur percent? true (inc j)) (recur percent? (inc j))))))))
(recur percent? plus? (inc j))))))))
(view [_] [key (view matcher)]) (view [_] [key (view matcher)])
(depth [_] (inc (depth matcher)))))) (depth [_] (inc (depth matcher))))))
@ -182,8 +168,7 @@
:cljs (let [match (->Match data nil)] :cljs (let [match (->Match data nil)]
(reify Matcher (reify Matcher
(match [_ i max path] (match [_ i max path]
(if (< i max) (if (< i max) (-assoc! match key (decode! path i max true))))
(-assoc! match key (decode! path i max))))
(view [_] [key [data]]) (view [_] [key [data]])
(depth [_] 1))))) (depth [_] 1)))))