Function: comp--op-case

comp--op-case is a macro defined in comp.el.gz.

Signature

(comp--op-case &rest CASES)

Documentation

Expand CASES into the corresponding pcase expansion.

This is responsible for generating the proper stack adjustment, when known, and the annotation emission.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/comp.el.gz
(defmacro comp--op-case (&rest cases)
  "Expand CASES into the corresponding `pcase' expansion.
This is responsible for generating the proper stack adjustment, when known,
and the annotation emission."
  (declare (debug (body))
           (indent defun))
  (declare-function comp--body-eff nil (body op-name sp-delta))
  `(pcase op
     ,@(cl-loop for (op . body) in cases
		for sp-delta = (gethash op comp-op-stack-info)
                for op-name = (symbol-name op)
		if body
		collect `(',op
                          ;; Log all LAP ops except the TAG one.
                          ;; ,(unless (eq op 'TAG)
                          ;;    `(comp--emit-annotation
                          ;;      ,(concat "LAP op " op-name)))
                          ;; Emit the stack adjustment if present.
                          ,(when (and sp-delta (not (eq 0 sp-delta)))
			     `(cl-incf (comp--sp) ,sp-delta))
                          ,@(comp--body-eff body op-name sp-delta))
                else
		collect `(',op (signal 'native-ice
                                       (list "unsupported LAP op" ',op-name))))
     (_ (signal 'native-ice (list "unexpected LAP op" (symbol-name op))))))