Function: byte-compile-discard

byte-compile-discard is a byte-compiled function defined in bytecomp.el.gz.

Signature

(byte-compile-discard &optional NUM PRESERVE-TOS)

Documentation

Output byte codes to discard the NUM entries at the top of the stack.

NUM defaults to 1. If PRESERVE-TOS is non-nil, preserve the top-of-stack value, as if it were popped before discarding the num values, and then pushed back again after discarding.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/bytecomp.el.gz
(defun byte-compile-discard (&optional num preserve-tos)
  "Output byte codes to discard the NUM entries at the top of the stack.
NUM defaults to 1.
If PRESERVE-TOS is non-nil, preserve the top-of-stack value, as if it were
popped before discarding the num values, and then pushed back again after
discarding."
  (if (and (null num) (not preserve-tos))
      ;; common case
      (byte-compile-out 'byte-discard)
    ;; general case
    (unless num
      (setq num 1))
    (when (and preserve-tos (> num 0))
      ;; Preserve the top-of-stack value by writing it directly to the stack
      ;; location which will be at the top-of-stack after popping.
      (byte-compile-stack-set (1- (- byte-compile-depth num)))
      ;; Now we actually discard one less value, since we want to keep
      ;; the eventual TOS
      (setq num (1- num)))
    (while (> num 0)
      (byte-compile-out 'byte-discard)
      (setq num (1- num)))))