Function: bytecomp--log-lap-arg

bytecomp--log-lap-arg is a byte-compiled function defined in byte-opt.el.gz.

Signature

(bytecomp--log-lap-arg ARG)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/byte-opt.el.gz
(defun bytecomp--log-lap-arg (arg)
  ;; Convert an argument that may be a LAP operation to something printable.
  (cond
   ;; Symbols are just stripped of their -byte prefix if any.
   ((symbolp arg)
    (intern (string-remove-prefix "byte-" (symbol-name arg))))
   ;; Conses are assumed to be LAP ops or tags.
   ((and (consp arg) (symbolp (car arg)))
    (let* ((head (car arg))
           (tail (cdr arg))
           (op (intern (string-remove-prefix "byte-" (symbol-name head)))))
      (cond
       ((eq head 'TAG)
        (format "%d:" (car tail)))
       ((memq head byte-goto-ops)
        (format "(%s %d)" op (cadr tail)))
       ((memq head byte-constref-ops)
        (format "(%s %s)"
                (if (eq op 'constant) 'const op)
                (if (numberp tail)
                    (format "<V%d>" tail)     ; closure var reference
                  (format "%S" (car tail))))) ; actual constant
       ;; Ops with an immediate argument.
       ((memq op '( stack-ref stack-set call unbind
                    listN concatN insertN discardN discardN-preserve-tos))
        (format "(%s %S)" op tail))
       ;; Without immediate, print just the symbol.
       (t op))))
   ;; Anything else is printed as-is.
   (t arg)))