|
6961 | 6961 | (dissoc! m k))) |
6962 | 6962 | (transient (.- self -proxy-mappings))) |
6963 | 6963 | (persistent!))] |
6964 | | - (set! (.- self -proxy-mappings) updated-mappings) |
| 6964 | + (. self (_set_proxy_mappings updated-mappings)) |
6965 | 6965 | nil)) |
6966 | 6966 | "_proxy_mappings" nil} |
6967 | 6967 |
|
|
7053 | 7053 | (. proxy (_update-proxy-mappings mappings)) |
7054 | 7054 | proxy))) |
7055 | 7055 |
|
7056 | | -;; TODO: kwargs on supertypes |
7057 | 7056 | ;; TODO: check interface/superclass method membership |
7058 | 7057 | (defmacro proxy |
7059 | 7058 | "Create a new proxy class instance. |
|
7082 | 7081 | ([arg1] ...) |
7083 | 7082 | ([arg1 & others] ...)) |
7084 | 7083 |
|
| 7084 | + .. note:: |
| 7085 | + |
| 7086 | + Proxy override methods can be defined with Python keyword argument support since |
| 7087 | + they are just standard Basilisp functions. See :ref:`basilisp_functions_with_kwargs` |
| 7088 | + for more information. |
| 7089 | + |
7085 | 7090 | .. warning:: |
7086 | 7091 |
|
7087 | 7092 | The ``proxy`` macro does not verify that the provided override implementations |
7088 | 7093 | arities match those of the method being overridden." |
7089 | 7094 | [class-and-interfaces args & fs] |
7090 | 7095 | (let [formatted-single (fn [method-name [arg-vec & body]] |
7091 | | - [(munge method-name) |
7092 | | - (apply list 'fn method-name (vec (concat ['this] arg-vec)) body)]) |
| 7096 | + (apply list |
| 7097 | + 'fn |
| 7098 | + method-name |
| 7099 | + (with-meta (vec (concat ['this] arg-vec)) (meta arg-vec)) |
| 7100 | + body)) |
7093 | 7101 | formatted-multi (fn [method-name & arities] |
7094 | | - [(munge method-name) |
7095 | | - (apply list |
7096 | | - 'fn |
7097 | | - method-name |
7098 | | - (map (fn [[arg-vec & body]] |
7099 | | - (apply list (vec (concat ['this] arg-vec)) body)) |
7100 | | - arities))]) |
7101 | | - methods (map (fn [[method-name & body]] |
7102 | | - (if (vector? (first body)) |
7103 | | - (formatted-single method-name body) |
7104 | | - (apply formatted-multi method-name body))) |
| 7102 | + (apply list |
| 7103 | + 'fn |
| 7104 | + method-name |
| 7105 | + (map (fn [[arg-vec & body]] |
| 7106 | + (apply list |
| 7107 | + (with-meta (vec (concat ['this] arg-vec)) (meta arg-vec)) |
| 7108 | + body)) |
| 7109 | + arities))) |
| 7110 | + methods (map (fn [[method-name & body :as form]] |
| 7111 | + [(munge method-name) |
| 7112 | + (with-meta |
| 7113 | + (if (vector? (first body)) |
| 7114 | + (formatted-single method-name body) |
| 7115 | + (apply formatted-multi method-name body)) |
| 7116 | + (meta form))]) |
7105 | 7117 | fs) |
7106 | 7118 | method-map (reduce* (fn [m [method-name method]] |
7107 | 7119 | (if-let [existing-method (get m method-name)] |
|
0 commit comments