|
162 | 162 | (not (resolve-ns (symbol opns) env)) |
163 | 163 | (maybe-class-literal opns))] |
164 | 164 |
|
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)))) |
194 | 180 |
|
195 | 181 | (cond |
196 | 182 | (.startsWith opname ".") ; (.foo bar ..) |
197 | 183 | (let [[target & args] expr |
198 | 184 | target (if-let [target (maybe-class-literal target)] |
199 | 185 | (with-meta (list 'do target) |
200 | | - {:tag 'java.lang.Class}) |
| 186 | + {:tag 'java.lang.Class}) |
201 | 187 | target) |
202 | 188 | args (list* (symbol (subs opname 1)) args)] |
203 | 189 | (with-meta (list '. target (if (= 1 (count args)) ;; we don't know if (.foo bar) is |
204 | 190 | (first args) args)) ;; a method call or a field access |
205 | | - (meta form))) |
| 191 | + (meta form))) |
206 | 192 |
|
207 | 193 | (.endsWith opname ".") ;; (class. ..) |
208 | 194 | (with-meta (list* 'new (symbol (subs opname 0 (dec (count opname)))) expr) |
|
0 commit comments