Skip to content

Commit cfbc4b3

Browse files
committed
feat: emit-form preserves param-tags if needed
1 parent d61a85c commit cfbc4b3

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

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

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -113,23 +113,36 @@
113113
tests thens))
114114
~switch-type ~test-type ~skip-check?))
115115

116+
(defmethod -emit-form :new
117+
[{:keys [class args param-tags]} opts]
118+
(if param-tags
119+
(let [sym (symbol (class->str (:val class)) "new")
120+
sym (vary-meta sym assoc :param-tags param-tags)]
121+
`(~sym ~@(mapv #(-emit-form* % opts) args)))
122+
`(new ~(-emit-form* class opts) ~@(mapv #(-emit-form* % opts) args))))
123+
116124
(defmethod -emit-form :static-field
117125
[{:keys [class field]} opts]
118126
(symbol (class->str class) (name field)))
119127

120128
(defmethod -emit-form :static-call
121-
[{:keys [class method args]} opts]
122-
`(~(symbol (class->str class) (name method))
123-
~@(mapv #(-emit-form* % opts) args)))
129+
[{:keys [class method args param-tags]} opts]
130+
(let [sym (symbol (class->str class) (name method))
131+
sym (if param-tags (vary-meta sym assoc :param-tags param-tags) sym)]
132+
`(~sym ~@(mapv #(-emit-form* % opts) args))))
124133

125134
(defmethod -emit-form :instance-field
126135
[{:keys [instance field]} opts]
127136
`(~(symbol (str ".-" (name field))) ~(-emit-form* instance opts)))
128137

129138
(defmethod -emit-form :instance-call
130-
[{:keys [instance method args]} opts]
131-
`(~(symbol (str "." (name method))) ~(-emit-form* instance opts)
132-
~@(mapv #(-emit-form* % opts) args)))
139+
[{:keys [instance method args class param-tags]} opts]
140+
(if param-tags
141+
(let [sym (symbol (class->str class) (str "." (name method)))
142+
sym (vary-meta sym assoc :param-tags param-tags)]
143+
`(~sym ~(-emit-form* instance opts) ~@(mapv #(-emit-form* % opts) args)))
144+
`(~(symbol (str "." (name method))) ~(-emit-form* instance opts)
145+
~@(mapv #(-emit-form* % opts) args))))
133146

134147
(defmethod -emit-form :prim-invoke
135148
[{:keys [fn args]} opts]

0 commit comments

Comments
 (0)