File tree Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Expand file tree Collapse file tree 2 files changed +21
-7
lines changed Original file line number Diff line number Diff line change 3166
3166
:requires requires
3167
3167
:renames (merge renames core-renames)
3168
3168
:imports imports}]
3169
- (swap! env/*compiler* update-in [::namespaces name] merge ns-info)
3169
+ (swap! env/*compiler* update-in [::namespaces name]
3170
+ (fn [the-ns]
3171
+ ; ; just merge - do not replace - then macros can emit
3172
+ ; ; modifications to the ns
3173
+ (reduce-kv
3174
+ (fn [the-ns k v]
3175
+ (if (map? v)
3176
+ (update the-ns k merge v)
3177
+ (assoc the-ns k v)))
3178
+ the-ns ns-info)))
3170
3179
(merge {:op :ns
3171
3180
:env env
3172
3181
:form form
Original file line number Diff line number Diff line change 1496
1496
(deftest test-cljs-3276-require-from-macro
1497
1497
(let [cenv (env/default-compiler-env )]
1498
1498
(env/with-compiler-env cenv
1499
- (ana/analyze-form-seq
1500
- '[(ns test.foo
1501
- (:require-macros [cljs-3276.macros :refer [macro-that-requires]]))
1502
- (macro-that-requires )]))
1503
- (is (= '{cljs-3276.foo cljs-3276.foo} (get-in @cenv [::ana/namespaces 'test.foo :requires ])))
1504
- (is (contains? (get @cenv ::ana/namespaces ) 'cljs-3276.foo))))
1499
+ (comp/with-core-cljs {}
1500
+ (fn []
1501
+ (ana/analyze-form-seq
1502
+ '[(ns test.foo
1503
+ (:require [clojure.set :as set])
1504
+ (:require-macros [cljs-3276.macros :refer [macro-that-requires]]))
1505
+ (macro-that-requires )]))))
1506
+ (is (= '{set clojure.set, clojure.set clojure.set, cljs-3276.foo cljs-3276.foo}
1507
+ (get-in @cenv [::ana/namespaces 'test.foo :requires ])))
1508
+ (is (contains? (get @cenv ::ana/namespaces ) 'cljs-3276.foo))
1509
+ (is (contains? (get @cenv ::ana/namespaces ) 'clojure.set))))
You can’t perform that action at this time.
0 commit comments