summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2018-07-17 22:22:15 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2018-07-17 22:22:41 -0400
commitba6cc1d04cef8e25534a72e90a8f0f8db0026c9f (patch)
tree471f0b6438dc86e37c53ca5e4184ee463b21f6ae
parent1c79d15863b768fe3156647a54d03a90688dd361 (diff)
downloademacs-ba6cc1d04cef8e25534a72e90a8f0f8db0026c9f.tar.gz
emacs-ba6cc1d04cef8e25534a72e90a8f0f8db0026c9f.tar.bz2
emacs-ba6cc1d04cef8e25534a72e90a8f0f8db0026c9f.zip
* lisp/net/soap-client.el (soap-type-of): Optimize for Emacs≥26
-rw-r--r--lisp/net/soap-client.el21
1 files changed, 13 insertions, 8 deletions
diff --git a/lisp/net/soap-client.el b/lisp/net/soap-client.el
index 17f83082f8d..f5de05dc3d7 100644
--- a/lisp/net/soap-client.el
+++ b/lisp/net/soap-client.el
@@ -685,14 +685,17 @@ This is a specialization of `soap-decode-type' for
(anyType (soap-decode-any-type node))
(Array (soap-decode-array node))))))
-(defun soap-type-of (element)
- "Return the type of ELEMENT."
- ;; Support Emacs < 26 byte-code running in Emacs >= 26 sessions
- ;; (Bug#31742).
- (let ((type (type-of element)))
- (if (eq type 'vector)
- (aref element 0) ; For Emacs 25 and earlier.
- type)))
+(defalias 'soap-type-of
+ (if (eq 'soap-xs-basic-type (type-of (make-soap-xs-basic-type)))
+ ;; `type-of' in Emacs ≥ 26 already does what we need.
+ #'type-of
+ ;; For Emacs < 26, use our own function.
+ (lambda (element)
+ "Return the type of ELEMENT."
+ (if (vectorp element)
+ (aref element 0) ;Assume this vector is actually a struct!
+ ;; This should never happen.
+ (type-of element)))))
;; Register methods for `soap-xs-basic-type'
(let ((tag (soap-type-of (make-soap-xs-basic-type))))
@@ -2881,6 +2884,8 @@ reference multiRef parts which are external to RESPONSE-NODE."
;;;; SOAP type encoding
+;; FIXME: Use `cl-defmethod' (but this requires Emacs-25).
+
(defun soap-encode-attributes (value type)
"Encode XML attributes for VALUE according to TYPE.
This is a generic function which determines the attribute encoder