Skip to content

Commit d61a85c

Browse files
committed
don't try to fit it with ., just keep as invoke of method-values for now
1 parent cd839da commit d61a85c

2 files changed

Lines changed: 19 additions & 37 deletions

File tree

src/main/clojure/clojure/tools/analyzer/jvm.clj

Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -162,47 +162,33 @@
162162
(not (resolve-ns (symbol opns) env))
163163
(maybe-class-literal opns))]
164164

165-
(let [param-tags (param-tags-of op)
166-
form-meta (cond-> (meta form)
167-
param-tags (assoc :param-tags param-tags))]
168-
(cond
169-
;; (Class/new args) -> (new Class args)
170-
(= "new" opname)
171-
(with-meta (list* 'new target expr)
172-
form-meta)
173-
174-
;; (Class/.method target args) -> (. ^Class (do target) (method rest-args))
175-
(.startsWith ^String opname ".")
176-
(if (seq expr)
177-
(let [method-sym (symbol (subs opname 1))
178-
[target-arg & args] expr]
179-
(with-meta (list '. (with-meta (list 'do target-arg)
180-
{:tag target})
181-
(if (seq args)
182-
(list* method-sym args)
183-
method-sym))
184-
form-meta))
185-
form)
186-
187-
;; (Class/method args) -> (. Class (method args))
188-
:else
189-
(let [op-sym (symbol opname)]
190-
(with-meta (list '. target (if (seq expr)
191-
(list* op-sym expr)
192-
op-sym))
193-
form-meta))))
165+
(cond
166+
;; (Class/new args), (Class/.method target args), (^[pt] Class/method args)
167+
;; -> leave as-is, will be analyzed as invoke of method-value
168+
(or (= "new" opname)
169+
(.startsWith ^String opname ".")
170+
(param-tags-of op))
171+
form
172+
173+
;; (Class/method args) -> (. Class (method args))
174+
:else
175+
(let [op-sym (symbol opname)]
176+
(with-meta (list '. target (if (seq expr)
177+
(list* op-sym expr)
178+
op-sym))
179+
(meta form))))
194180

195181
(cond
196182
(.startsWith opname ".") ; (.foo bar ..)
197183
(let [[target & args] expr
198184
target (if-let [target (maybe-class-literal target)]
199185
(with-meta (list 'do target)
200-
{:tag 'java.lang.Class})
186+
{:tag 'java.lang.Class})
201187
target)
202188
args (list* (symbol (subs opname 1)) args)]
203189
(with-meta (list '. target (if (= 1 (count args)) ;; we don't know if (.foo bar) is
204190
(first args) args)) ;; a method call or a field access
205-
(meta form)))
191+
(meta form)))
206192

207193
(.endsWith opname ".") ;; (class. ..)
208194
(with-meta (list* 'new (symbol (subs opname 0 (dec (count opname)))) expr)

src/main/clojure/clojure/tools/analyzer/passes/jvm/analyze_host_expr.clj

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -166,12 +166,8 @@
166166
(case op
167167

168168
:host-call
169-
(let [result (analyze-host-call target-type (:method ast)
170-
(:args ast) target class? env)
171-
param-tags (param-tags-of form)]
172-
(if param-tags
173-
(assoc result :param-tags param-tags)
174-
result))
169+
(analyze-host-call target-type (:method ast)
170+
(:args ast) target class? env)
175171

176172
:host-field
177173
(analyze-host-field target-type (:field ast)

0 commit comments

Comments
 (0)