Skip to content

Commit

Permalink
* bin/cljsc: fix :refer-clojure :exclude and :use-macros :only combin…
Browse files Browse the repository at this point in the history
…ation bug.
  • Loading branch information
David Nolen authored and David Nolen committed Apr 4, 2012
1 parent 7472ab9 commit aef60c2
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion bin/cljsc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ "$CLOJURESCRIPT_HOME" = "" ]; then
fi

CLJSC_CP=''
for next in lib/*: src/clj: src/cljs; do
for next in lib/*: src/clj: src/cljs: test/cljs; do
CLJSC_CP=$CLJSC_CP$CLOJURESCRIPT_HOME'/'$next
done

Expand Down
3 changes: 2 additions & 1 deletion src/clj/cljs/compiler.clj
Original file line number Diff line number Diff line change
Expand Up @@ -1034,7 +1034,8 @@
(defn get-expander [sym env]
(let [mvar
(when-not (or (-> env :locals sym) ;locals hide macros
(-> env :ns :excludes sym))
(and (-> env :ns :excludes sym)
(not (-> env :ns :uses-macros sym))))
(if-let [nstr (namespace sym)]
(when-let [ns (cond
(= "clojure.core" nstr) (find-ns 'cljs.core)
Expand Down
6 changes: 6 additions & 0 deletions test/cljs/cljs/macro_test.cljs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
(ns cljs.macro-test
(:refer-clojure :exclude [==])
(:use-macros [cljs.macro-test.macros :only [==]]))

(defn test-macros []
(assert (= (== 1 1) 2)))
5 changes: 5 additions & 0 deletions test/cljs/cljs/macro_test/macros.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
(ns cljs.macro-test.macros
(:refer-clojure :exclude [==]))

(defmacro == [a b]
`(+ ~a ~b))
4 changes: 3 additions & 1 deletion test/cljs/test_runner.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
[cljs.reader-test :as reader-test]
[cljs.binding-test :as binding-test]
[cljs.ns-test :as ns-test]
[clojure.string-test :as string-test]))
[clojure.string-test :as string-test]
[cljs.macro-test :as macro-test]))

(set! *print-fn* js/print)

Expand All @@ -12,6 +13,7 @@
(string-test/test-string)
(binding-test/test-binding)
(ns-test/test-ns)
(macro-test/test-macros)

(println "Tests completed without exception")

Expand Down

0 comments on commit aef60c2

Please sign in to comment.