Skip to content

Commit 56d3ee4

Browse files
committed
CLJS-2661: Ominous dangerous use of 'this' warning
Add other bits from Andre Rauh's patch. Variadic invoke can go directly, internal invokes are done via `this`. The previous commit's Closure type information is enough to suppress the warning.
1 parent 1b8c1e7 commit 56d3ee4

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

src/main/clojure/cljs/core.cljc

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3017,15 +3017,11 @@
30173017
([~restarg]
30183018
(let [~@(mapcat param-bind params)]
30193019
(this-as self#
3020-
(if (identical? js/Function (type self#))
3021-
(. self# (~(get-delegate) ~@params ~restarg))
3022-
(. ~sym (~(get-delegate) ~@params ~restarg))))))))
3020+
(. self# (~(get-delegate) ~@params ~restarg)))))))
30233021
`(fn
30243022
([~restarg]
30253023
(this-as self#
3026-
(if (identical? js/Function (type self#))
3027-
(. self# (~(get-delegate) (seq ~restarg)))
3028-
(. ~sym (~(get-delegate) (seq ~restarg)))))))))]
3024+
(. self# (~(get-delegate) (seq ~restarg))))))))]
30293025
`(do
30303026
(set! (. ~sym ~(get-delegate-prop))
30313027
(fn (~(vec sig) ~@body)))
@@ -3065,10 +3061,7 @@
30653061
(let [argseq# (when (< ~c-1 (alength args#))
30663062
(new ^::ana/no-resolve cljs.core/IndexedSeq
30673063
(.slice args# ~c-1) 0 nil))]
3068-
(this-as self#
3069-
(if (identical? js/Function (type self#))
3070-
(. self# (~'cljs$core$IFn$_invoke$arity$variadic ~@(dest-args c-1) argseq#))
3071-
(. ~rname (~'cljs$core$IFn$_invoke$arity$variadic ~@(dest-args c-1) argseq#))))))))
3064+
(. ~rname (~'cljs$core$IFn$_invoke$arity$variadic ~@(dest-args c-1) argseq#))))))
30723065
~(variadic-fn* rname method)
30733066
~(core/when emit-var? `(var ~name))))))
30743067

0 commit comments

Comments
 (0)