Function: eieio--pcase-macroexpander

eieio--pcase-macroexpander is a function defined in eieio.el.gz.

Signature

(eieio--pcase-macroexpander &rest FIELDS)

Documentation

Pcase patterns that match EIEIO object EXPVAL.

Elements of FIELDS can be of the form (NAME PAT) in which case the contents of field NAME is matched against PAT, or they can be of
 the form NAME which is a shorthand for (NAME NAME).

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/eieio.el.gz
;; Closure converted to defun by helpful.
(defun eieio--pcase-macroexpander
    (&rest fields)
  "Pcase patterns that match EIEIO object EXPVAL.\nElements of FIELDS can be of the form (NAME PAT) in which case the\ncontents of field NAME is matched against PAT, or they can be of\n the form NAME which is a shorthand for (NAME NAME)."
  `(and
    (pred eieio-object-p)
    ,@(mapcar
       (lambda
	 (field)
	 (pcase-exhaustive field
	   (`(,name ,pat)
	    `(app
	      (pcase--flip eieio-oref ',name)
	      ,pat))
	   ((pred symbolp)
	    `(app
	      (pcase--flip eieio-oref ',field)
	      ,field))))
       fields)))