advise cljs compiler not to warn about undeclared var instead of the hack that was being used before

This commit is contained in:
Nathan Marz 2016-05-29 09:06:51 -04:00
parent 637f7fc819
commit d162c2b49f
2 changed files with 6 additions and 6 deletions

View file

@ -12,6 +12,7 @@
[clojure.string :as s] [clojure.string :as s]
#+clj [com.rpl.specter.defhelpers :as dh] #+clj [com.rpl.specter.defhelpers :as dh]
#+clj [riddley.walk :as riddley] #+clj [riddley.walk :as riddley]
;; #+cljs [cljs.js :as cljs]
) )
#+clj #+clj
(:import [com.rpl.specter Util]) (:import [com.rpl.specter Util])

View file

@ -445,15 +445,16 @@
;; to invoke and/or parameterize the precompiled path without ;; to invoke and/or parameterize the precompiled path without
;; a bunch of checks beforehand ;; a bunch of checks beforehand
cache-id (if (= platform :clj) (i/gen-uuid-str)) cache-id (if (= platform :clj) (i/gen-uuid-str))
cache-sym (gensym "pathcache") ;; used for cljs cache-sym (if (= platform :cljs)
(vary-meta
(gensym "pathcache")
assoc :cljs.analyzer/no-resolve true))
;; this is used to avoid warnings in cljs code about undeclared var
cache-qualified-sym (symbol (str *ns* "." cache-sym))
info-sym (gensym "info") info-sym (gensym "info")
get-cache-code (if (= platform :clj) get-cache-code (if (= platform :clj)
`(i/get-path-cache ~cache-id) `(i/get-path-cache ~cache-id)
cache-qualified-sym cache-sym
) )
add-cache-code (if (= platform :clj) add-cache-code (if (= platform :clj)
`(i/add-path-cache! ~cache-id ~info-sym) `(i/add-path-cache! ~cache-id ~info-sym)
@ -480,8 +481,6 @@
~prepared-path ~prepared-path
~(str *ns*) ~(str *ns*)
(quote ~used-locals) (quote ~used-locals)
;;possible-params is wrong atm
;;as is used-locals in cljs...
(quote ~possible-params) (quote ~possible-params)
)] )]
~add-cache-code ~add-cache-code