|
6870 | 6870 | (dissoc! m k))) |
6871 | 6871 | (transient (.- self -proxy-mappings))) |
6872 | 6872 | (persistent!))] |
6873 | | - (set! (.- self -proxy-mappings) updated-mappings) |
| 6873 | + (. self (_set_proxy_mappings updated-mappings)) |
6874 | 6874 | nil)) |
6875 | 6875 | "_proxy_mappings" nil} |
6876 | 6876 |
|
|
6962 | 6962 | (. proxy (_update-proxy-mappings mappings)) |
6963 | 6963 | proxy))) |
6964 | 6964 |
|
6965 | | -;; TODO: kwargs on supertypes |
6966 | 6965 | ;; TODO: check interface/superclass method membership |
6967 | 6966 | (defmacro proxy |
6968 | 6967 | "Create a new proxy class instance. |
|
6991 | 6990 | ([arg1] ...) |
6992 | 6991 | ([arg1 & others] ...)) |
6993 | 6992 |
|
| 6993 | + .. note:: |
| 6994 | + |
| 6995 | + Proxy override methods can be defined with Python keyword argument support since |
| 6996 | + they are just standard Basilisp functions. See :ref:`basilisp_functions_with_kwargs` |
| 6997 | + for more information. |
| 6998 | + |
6994 | 6999 | .. warning:: |
6995 | 7000 |
|
6996 | 7001 | The ``proxy`` macro does not verify that the provided override implementations |
6997 | 7002 | arities match those of the method being overridden." |
6998 | 7003 | [class-and-interfaces args & fs] |
6999 | 7004 | (let [formatted-single (fn [method-name [arg-vec & body]] |
7000 | | - [(munge method-name) |
7001 | | - (apply list 'fn method-name (vec (concat ['this] arg-vec)) body)]) |
| 7005 | + (apply list |
| 7006 | + 'fn |
| 7007 | + method-name |
| 7008 | + (with-meta (vec (concat ['this] arg-vec)) (meta arg-vec)) |
| 7009 | + body)) |
7002 | 7010 | formatted-multi (fn [method-name & arities] |
7003 | | - [(munge method-name) |
7004 | | - (apply list |
7005 | | - 'fn |
7006 | | - method-name |
7007 | | - (map (fn [[arg-vec & body]] |
7008 | | - (apply list (vec (concat ['this] arg-vec)) body)) |
7009 | | - arities))]) |
7010 | | - methods (map (fn [[method-name & body]] |
7011 | | - (if (vector? (first body)) |
7012 | | - (formatted-single method-name body) |
7013 | | - (apply formatted-multi method-name body))) |
| 7011 | + (apply list |
| 7012 | + 'fn |
| 7013 | + method-name |
| 7014 | + (map (fn [[arg-vec & body]] |
| 7015 | + (apply list |
| 7016 | + (with-meta (vec (concat ['this] arg-vec)) (meta arg-vec)) |
| 7017 | + body)) |
| 7018 | + arities))) |
| 7019 | + methods (map (fn [[method-name & body :as form]] |
| 7020 | + [(munge method-name) |
| 7021 | + (with-meta |
| 7022 | + (if (vector? (first body)) |
| 7023 | + (formatted-single method-name body) |
| 7024 | + (apply formatted-multi method-name body)) |
| 7025 | + (meta form))]) |
7014 | 7026 | fs) |
7015 | 7027 | method-map (reduce* (fn [m [method-name method]] |
7016 | 7028 | (if-let [existing-method (get m method-name)] |
|
0 commit comments