Skip to content

Commit 3122975

Browse files
CLJS-3468: :refer-global should not make unrenamed object available (#301)
Co-authored-by: Michiel Borkent <[email protected]>
1 parent c4295f3 commit 3122975

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/main/clojure/cljs/analyzer.cljc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3098,7 +3098,8 @@ x (not (contains? ret :info)))
30983098
(throw (error env (str err-str (pr-str parsed-spec)))))
30993099
(when-not (every? #{:only :rename} (keys parsed-spec))
31003100
(throw (error env (str err-str (pr-str parsed-spec)))))
3101-
{:use (zipmap only (repeat 'js))
3101+
{:use (zipmap (if rename (remove rename only)
3102+
only) (repeat 'js))
31023103
:rename (into {}
31033104
(map (fn [[orig new-name]]
31043105
[new-name (symbol "js" (str orig))]))

src/test/clojure/cljs/analyzer_tests.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@
391391
(let [parsed (ana/parse-global-refer-spec {}
392392
'((:refer-global :only [Date Symbol] :rename {Symbol JSSymbol})))]
393393
(is (= parsed
394-
'{:use {Date js Symbol js}
394+
'{:use {Date js}
395395
:rename {JSSymbol js/Symbol}}))))
396396

397397
(deftest test-parse-require-global

0 commit comments

Comments
 (0)