File tree Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Expand file tree Collapse file tree 3 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 2384
2384
(let [init-expr (analyze-let-binding-init env init (cons {:params bes} *loop-lets*))
2385
2385
line (get-line name env)
2386
2386
col (get-col name env)
2387
- shadow (handle-symbol-local name (get-in env [:locals name]))
2387
+ shadow (or (handle-symbol-local name (get-in env [:locals name]))
2388
+ (get-in env [:js-globals name]))
2388
2389
be {:name name
2389
2390
:line line
2390
2391
:column col
Original file line number Diff line number Diff line change 1113
1113
ana/*fn-invoke-direct* (and static-fns fn-invoke-direct)
1114
1114
*repl-opts* opts]
1115
1115
(try
1116
- (let [env { :context :expr :locals {}}
1116
+ (let [env ( assoc ( ana/empty-env ) :context :expr )
1117
1117
special-fns (merge default-special-fns special-fns)
1118
1118
is-special-fn? (set (keys special-fns))
1119
1119
request-prompt (Object. )
Original file line number Diff line number Diff line change 365
365
ns-info (env/ensure (comp/emit-source input output " cljs" {}))]
366
366
(is (= 'foo.foo (:ns ns-info)))))
367
367
368
+ (deftest test-3368-global-shadowing
369
+ (testing " Let binding which use JS global names should get shadowed"
370
+ (let [code (env/with-compiler-env (env/default-compiler-env )
371
+ (compile-form-seq
372
+ '[(defn foo []
373
+ (let [window js/window]
374
+ window))]))]
375
+ (is (re-find #"window__\$ 1" code)))))
368
376
369
377
; ; CLJS-1225
370
378
You can’t perform that action at this time.
0 commit comments