-
Notifications
You must be signed in to change notification settings - Fork 1
/
tag_readers.cljc
33 lines (29 loc) · 930 Bytes
/
tag_readers.cljc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
(ns prpr.a-frame.interceptor-chain.data.tag-readers
#?(:cljs (:require-macros [prpr.a-frame.interceptor-chain.data.tag-readers]))
(:require
#?(:clj [prpr.util.macro :refer [if-cljs]])
[prpr.a-frame.interceptor-chain.data.data-path
:refer [->DataPath]]))
;; see https://github.com/clojure/clojurescript-site/issues/371
;; 3! different versions of the tag-readers are required for:
;; 1. clj compiling cljs
;; 2. clj
;; 3. cljs self-hosted or runtime
#?(:clj
(defn read-ctx-path
[path]
(if-cljs
`(->DataPath (into
[]
~path))
;; if we eval the path then we can use var symbols
;; in the path. this will only work on clj
(->DataPath (into
[]
(eval path))))))
#?(:cljs
(defn ^:export read-ctx-path
[path]
`(->DataPath (into
[]
~path))))