Function: byte-compile-file-form-defmumble

byte-compile-file-form-defmumble is a byte-compiled function defined in bytecomp.el.gz.

Signature

(byte-compile-file-form-defmumble NAME MACRO ARGLIST BODY REST)

Documentation

Process a defalias for NAME.

If MACRO is non-nil, the definition is known to be a macro. ARGLIST is the list of arguments, if it was recognized or t otherwise. BODY of the definition, or t if not recognized. Return non-nil if everything went as planned, or nil to imply that it decided not to take responsibility for the actual compilation of the code.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/bytecomp.el.gz
(defun byte-compile-file-form-defmumble (name macro arglist body rest)
  "Process a `defalias' for NAME.
If MACRO is non-nil, the definition is known to be a macro.
ARGLIST is the list of arguments, if it was recognized or t otherwise.
BODY of the definition, or t if not recognized.
Return non-nil if everything went as planned, or nil to imply that it decided
not to take responsibility for the actual compilation of the code."
  (let* ((this-kind (if macro 'byte-compile-macro-environment
                      'byte-compile-function-environment))
         (that-kind (if macro 'byte-compile-function-environment
                      'byte-compile-macro-environment))
         (this-one (assq name (symbol-value this-kind)))
         (that-one (assq name (symbol-value that-kind)))
         (bare-name (bare-symbol name))
         (byte-compile-current-form name)) ; For warnings.

    (push bare-name byte-compile-new-defuns)
    ;; When a function or macro is defined, add it to the call tree so that
    ;; we can tell when functions are not used.
    (if byte-compile-generate-call-tree
        (or (assq bare-name byte-compile-call-tree)
            (setq byte-compile-call-tree
                  (cons (list bare-name nil nil) byte-compile-call-tree))))

    (if (byte-compile-warning-enabled-p 'redefine name)
        (byte-compile-arglist-warn name arglist macro))

    (if byte-compile-verbose
        (message "Compiling %s... (%s)"
                 (or byte-compile-current-file "") bare-name))
    (cond ((not (or macro (listp body)))
           ;; We do not know positively if the definition is a macro
           ;; or a function, so we shouldn't emit warnings.
           ;; This also silences "multiple definition" warnings for defmethods.
           nil)
          (that-one
           (if (and (byte-compile-warning-enabled-p 'redefine name)
                    ;; Don't warn when compiling the stubs in byte-run...
                    (not (assq bare-name byte-compile-initial-macro-environment)))
               (byte-compile-warn-x
                name
                "`%s' defined multiple times, as both function and macro"
                bare-name))
           (setcdr that-one nil))
          (this-one
           (when (and (byte-compile-warning-enabled-p 'redefine name)
                      ;; Hack: Don't warn when compiling the magic internal
                      ;; byte-compiler macros in byte-run.el...
                      (not (assq bare-name byte-compile-initial-macro-environment)))
             (byte-compile-warn-x
              name
              "%s `%s' defined multiple times in this file"
              (if macro "macro" "function")
              bare-name)))
          ((eq (car-safe (symbol-function bare-name))
               (if macro 'lambda 'macro))
           (when (byte-compile-warning-enabled-p 'redefine bare-name)
             (byte-compile-warn-x
              name
              "%s `%s' being redefined as a %s"
              (if macro "function" "macro")
              bare-name
              (if macro "macro" "function")))
           ;; Shadow existing definition.
           (set this-kind
                (cons (cons bare-name nil)
                      (symbol-value this-kind))))
          )

    (when (and (listp body)
               (stringp (car body))
               (symbolp (car-safe (cdr-safe body)))
               (car-safe (cdr-safe body))
               (stringp (car-safe (cdr-safe (cdr-safe body)))))
      (byte-compile-warn-x
       name "probable `\"' without `\\' in doc string of %s" bare-name))

    (if (not (listp body))
        ;; The precise definition requires evaluation to find out, so it
        ;; will only be known at runtime.
        ;; For a macro, that means we can't use that macro in the same file.
        (progn
          (unless macro
            (push (cons bare-name (if (listp arglist) `(declared ,arglist) t))
                  byte-compile-function-environment))
          ;; Tell the caller that we didn't compile it yet.
          nil)

      (let ((code (byte-compile-lambda `(lambda ,arglist . ,body))))
        (if this-one
            ;; A definition in b-c-initial-m-e should always take precedence
            ;; during compilation, so don't let it be redefined.  (Bug#8647)
            (or (and macro
                     (assq bare-name byte-compile-initial-macro-environment))
                (setcdr this-one code))
          (set this-kind
               (cons (cons bare-name code)
                     (symbol-value this-kind))))

        (byte-compile-flush-pending)
        (let ((newform `(defalias ',bare-name
                         ,(if macro `'(macro . ,code) code) ,@rest)))
          (when byte-native-compiling
            ;; Don't let `byte-compile-output-file-form' push the form to
            ;; `byte-to-native-top-level-forms' because we want to use
            ;; `make-byte-to-native-func-def' when possible.
            (push
             (if (or macro rest)
                 (make-byte-to-native-top-level
                  :form newform
                  :lexical lexical-binding)
               (make-byte-to-native-func-def :name name
                                             :byte-func code))
             byte-to-native-top-level-forms))
          (let ((byte-native-compiling nil))
           (byte-compile-output-file-form newform)))
        t))))