|
7010 | 7010 | (dissoc! m k))) |
7011 | 7011 | (transient (.- self -proxy-mappings))) |
7012 | 7012 | (persistent!))] |
7013 | | - (set! (.- self -proxy-mappings) updated-mappings) |
| 7013 | + (. self (_set_proxy_mappings updated-mappings)) |
7014 | 7014 | nil)) |
7015 | 7015 | "_proxy_mappings" nil} |
7016 | 7016 |
|
|
7102 | 7102 | (. proxy (_update-proxy-mappings mappings)) |
7103 | 7103 | proxy))) |
7104 | 7104 |
|
7105 | | -;; TODO: kwargs on supertypes |
7106 | 7105 | ;; TODO: check interface/superclass method membership |
7107 | 7106 | (defmacro proxy |
7108 | 7107 | "Create a new proxy class instance. |
|
7131 | 7130 | ([arg1] ...) |
7132 | 7131 | ([arg1 & others] ...)) |
7133 | 7132 |
|
| 7133 | + .. note:: |
| 7134 | + |
| 7135 | + Proxy override methods can be defined with Python keyword argument support since |
| 7136 | + they are just standard Basilisp functions. See :ref:`basilisp_functions_with_kwargs` |
| 7137 | + for more information. |
| 7138 | + |
7134 | 7139 | .. warning:: |
7135 | 7140 |
|
7136 | 7141 | The ``proxy`` macro does not verify that the provided override implementations |
7137 | 7142 | arities match those of the method being overridden." |
7138 | 7143 | [class-and-interfaces args & fs] |
7139 | 7144 | (let [formatted-single (fn [method-name [arg-vec & body]] |
7140 | | - [(munge method-name) |
7141 | | - (apply list 'fn method-name (vec (concat ['this] arg-vec)) body)]) |
| 7145 | + (apply list |
| 7146 | + 'fn |
| 7147 | + method-name |
| 7148 | + (with-meta (vec (concat ['this] arg-vec)) (meta arg-vec)) |
| 7149 | + body)) |
7142 | 7150 | formatted-multi (fn [method-name & arities] |
7143 | | - [(munge method-name) |
7144 | | - (apply list |
7145 | | - 'fn |
7146 | | - method-name |
7147 | | - (map (fn [[arg-vec & body]] |
7148 | | - (apply list (vec (concat ['this] arg-vec)) body)) |
7149 | | - arities))]) |
7150 | | - methods (map (fn [[method-name & body]] |
7151 | | - (if (vector? (first body)) |
7152 | | - (formatted-single method-name body) |
7153 | | - (apply formatted-multi method-name body))) |
| 7151 | + (apply list |
| 7152 | + 'fn |
| 7153 | + method-name |
| 7154 | + (map (fn [[arg-vec & body]] |
| 7155 | + (apply list |
| 7156 | + (with-meta (vec (concat ['this] arg-vec)) (meta arg-vec)) |
| 7157 | + body)) |
| 7158 | + arities))) |
| 7159 | + methods (map (fn [[method-name & body :as form]] |
| 7160 | + [(munge method-name) |
| 7161 | + (with-meta |
| 7162 | + (if (vector? (first body)) |
| 7163 | + (formatted-single method-name body) |
| 7164 | + (apply formatted-multi method-name body)) |
| 7165 | + (meta form))]) |
7154 | 7166 | fs) |
7155 | 7167 | method-map (reduce* (fn [m [method-name method]] |
7156 | 7168 | (if-let [existing-method (get m method-name)] |
|
0 commit comments