   [x]
   (if (core/symbol? x)
     (core/let [resolved (:name (cljs.analyzer/resolve-var &env x))
-               y     (core/cond-> resolved
-                       (= "js" (namespace resolved)) name)
-               segs  (string/split (core/str (string/replace (core/str y) "/" ".")) #"\.")
-               n     (count segs)
-               syms  (map
-                       #(vary-meta (symbol "js" (string/join "." %))
-                          assoc :cljs.analyzer/no-resolve true)
-                       (reverse (take n (iterate butlast segs))))
-               js    (string/join " && " (repeat n "(typeof ~{} !== 'undefined')"))]
+               y (core/cond-> resolved
+                   (= "js" (namespace resolved)) name)
+               segs (string/split (core/str (string/replace (core/str y) "/" ".")) #"\.")
+               n (count segs)
+               syms (map
+                      #(vary-meta (symbol "js" (string/join "." %))
+                         assoc :cljs.analyzer/no-resolve true)
+                      (reverse (take n (iterate butlast segs))))
+               js (string/join " && " (repeat n "(typeof ~{} !== 'undefined')"))]
       (bool-expr (concat (core/list 'js* js) syms)))
     `(some? ~x)))

(defn resolve-cljs-var [ns sym]
  (merge (ana/gets @env/*compiler* ::ana/namespaces ns :defs sym)
    {:name (symbol (str ns) (str sym))
     :ns ns}))

(defn resolve-ns-var [ns sym current-ns]


(defn resolve-invokeable-ns [alias current-ns env]
  (let [ns (ana/resolve-ns-alias env alias)]
    {:op :js-var
     :name (symbol "js" (str ns))
     :tag 'js
     :ret-tag 'js
     :ns 'js}))

;; core.async calls `macroexpand-1` manually with an ill-formed
;; :locals map. Normally :locals maps symbols maps, but
;; core.async adds entries mapping symbols to symbols. We work
;; around that specific case here. This is called defensively
;; every time we lookup the :locals map.
(defn handle-symbol-local [sym lb]
  (if (symbol? lb)
    {:name sym}
    lb))

(def known-safe-js-globals
  "symbols known to be closureJS compliant namespaces"
