|
229 | 229 | (-> (:*cljs-dep-set* bound-vars) meta :dep-path)))
|
230 | 230 | (if (seq deps)
|
231 | 231 | (let [dep (first deps)]
|
232 |
| - (require bound-vars dep (dissoc opts :context) |
| 232 | + (require bound-vars dep |
| 233 | + (-> opts |
| 234 | + (dissoc :context) |
| 235 | + (dissoc :ns)) |
233 | 236 | (fn [res]
|
234 | 237 | (if-not (:error res)
|
235 | 238 | (load-deps bound-vars ana-env lib (next deps) opts cb)
|
|
286 | 289 | (require bound-vars nsym k
|
287 | 290 | (-> opts
|
288 | 291 | (assoc :macros-ns true)
|
289 |
| - (dissoc :context)) |
| 292 | + (dissoc :context) |
| 293 | + (dissoc :ns)) |
290 | 294 | (fn [res]
|
291 | 295 | (if-not (:error res)
|
292 | 296 | (load-macros bound-vars k (next macros) reload reloads opts cb)
|
|
359 | 363 | (let [rdr (rt/indexing-push-back-reader source 1 name)
|
360 | 364 | eof (js-obj)
|
361 | 365 | aenv (ana/empty-env)
|
362 |
| - bound-vars (cond-> (merge bound-vars |
363 |
| - {:*cljs-ns* 'cljs.user |
364 |
| - :*ns* (create-ns ana/*cljs-ns*)}) |
| 366 | + the-ns (or (:ns opts) 'cljs.user) |
| 367 | + bound-vars (cond-> (merge bound-vars {:*cljs-ns* the-ns}) |
365 | 368 | (:source-map opts) (assoc :*sm-data* (sm-data)))]
|
366 | 369 | ((fn analyze-loop []
|
367 | 370 | (binding [env/*compiler* (:*compiler* bound-vars)
|
368 | 371 | ana/*cljs-ns* (:*cljs-ns* bound-vars)
|
369 |
| - *ns* (:*ns* bound-vars) |
| 372 | + *ns* (create-ns (:*cljs-ns* bound-vars)) |
370 | 373 | r/*data-readers* (:*data-readers* bound-vars)
|
371 | 374 | comp/*source-map-data* (:*sm-data* bound-vars)]
|
372 | 375 | (let [res (try
|
|
442 | 445 | ;; Eval
|
443 | 446 |
|
444 | 447 | (defn eval* [bound-vars form opts cb]
|
445 |
| - (let [bound-vars (cond-> (merge bound-vars |
446 |
| - {:*cljs-ns* 'cljs.user |
447 |
| - :*ns* (create-ns ana/*cljs-ns*)}) |
| 448 | + (let [the-ns (or (:ns opts) 'cljs.user) |
| 449 | + bound-vars (cond-> (merge bound-vars {:*cljs-ns* the-ns}) |
448 | 450 | (:source-map opts) (assoc :*sm-data* (sm-data)))]
|
449 | 451 | (binding [env/*compiler* (:*compiler* bound-vars)
|
450 | 452 | *eval-fn* (:*eval-fn* bound-vars)
|
451 | 453 | ana/*cljs-ns* (:*cljs-ns* bound-vars)
|
452 |
| - *ns* (:*ns* bound-vars) |
| 454 | + *ns* (create-ns (:*cljs-ns* bound-vars)) |
453 | 455 | r/*data-readers* (:*data-readers* bound-vars)
|
454 | 456 | comp/*source-map-data* (:*sm-data* bound-vars)]
|
455 | 457 | (let [aenv (ana/empty-env)
|
|
500 | 502 | ([state form opts cb]
|
501 | 503 | (eval*
|
502 | 504 | {:*compiler* state
|
503 |
| - :*cljs-ns* 'cljs.user |
504 |
| - :*ns* (create-ns 'cljs.user) |
505 | 505 | :*data-readers* tags/*cljs-data-readers*
|
506 | 506 | :*analyze-deps* (or (:analyze-deps opts) true)
|
507 | 507 | :*load-macros* (or (:load-macros opts) true)
|
|
517 | 517 | eof (js-obj)
|
518 | 518 | aenv (ana/empty-env)
|
519 | 519 | sb (StringBuffer.)
|
520 |
| - bound-vars (cond-> (merge bound-vars |
521 |
| - {:*cljs-ns* 'cljs.user |
522 |
| - :*ns* (create-ns ana/*cljs-ns*)}) |
| 520 | + the-ns (or (:ns opts) 'cljs.user) |
| 521 | + bound-vars (cond-> (merge bound-vars {:*cljs-ns* the-ns}) |
523 | 522 | (:source-map opts) (assoc :*sm-data* (sm-data)))]
|
524 | 523 | ((fn compile-loop []
|
525 | 524 | (binding [env/*compiler* (:*compiler* bound-vars)
|
526 | 525 | *eval-fn* (:*eval-fn* bound-vars)
|
527 | 526 | ana/*cljs-ns* (:*cljs-ns* bound-vars)
|
528 |
| - *ns* (:*ns* bound-vars) |
| 527 | + *ns* (create-ns (:*cljs-ns* bound-vars)) |
529 | 528 | r/*data-readers* (:*data-readers* bound-vars)
|
530 | 529 | comp/*source-map-data* (:*sm-data* bound-vars)]
|
531 | 530 | (let [res (try
|
|
609 | 608 | eof (js-obj)
|
610 | 609 | aenv (ana/empty-env)
|
611 | 610 | sb (StringBuffer.)
|
612 |
| - bound-vars (cond-> (merge bound-vars |
613 |
| - {:*cljs-ns* 'cljs.user |
614 |
| - :*ns* (create-ns ana/*cljs-ns*)}) |
| 611 | + the-ns (or (:ns opts) 'cljs.user) |
| 612 | + bound-vars (cond-> (merge bound-vars {:*cljs-ns* the-ns}) |
615 | 613 | (:source-map opts) (assoc :*sm-data* (sm-data)))]
|
616 | 614 | (when (:verbose opts) (debug-prn "Evaluating" name))
|
617 | 615 | ((fn compile-loop [ns]
|
|
0 commit comments