comparison lisp/emacs-lisp/bytecomp.el @ 31541:3d47e1826bf4

(byte-compile-defvar): Only cons onto current-load-list in top-level forms. Else this leaks a cons cell every time a defun is called.
author Gerd Moellmann <gerd@gnu.org>
date Mon, 11 Sep 2000 18:26:01 +0000
parents a5b9dbab7b2f
children f17ccd7f6253
comparison
equal deleted inserted replaced
31540:774098937e4f 31541:3d47e1826bf4
8 ;; Maintainer: FSF 8 ;; Maintainer: FSF
9 ;; Keywords: lisp 9 ;; Keywords: lisp
10 10
11 ;;; This version incorporates changes up to version 2.10 of the 11 ;;; This version incorporates changes up to version 2.10 of the
12 ;;; Zawinski-Furuseth compiler. 12 ;;; Zawinski-Furuseth compiler.
13 (defconst byte-compile-version "$Revision: 2.73 $") 13 (defconst byte-compile-version "$Revision: 1.1 $")
14 14
15 ;; This file is part of GNU Emacs. 15 ;; This file is part of GNU Emacs.
16 16
17 ;; GNU Emacs is free software; you can redistribute it and/or modify 17 ;; GNU Emacs is free software; you can redistribute it and/or modify
18 ;; it under the terms of the GNU General Public License as published by 18 ;; it under the terms of the GNU General Public License as published by
3218 (string (nth 3 form))) 3218 (string (nth 3 form)))
3219 (if (memq 'free-vars byte-compile-warnings) 3219 (if (memq 'free-vars byte-compile-warnings)
3220 (setq byte-compile-bound-variables 3220 (setq byte-compile-bound-variables
3221 (cons var byte-compile-bound-variables))) 3221 (cons var byte-compile-bound-variables)))
3222 (byte-compile-body-do-effect 3222 (byte-compile-body-do-effect
3223 (list (if (cdr (cdr form)) 3223 (list
3224 (if (eq (car form) 'defconst) 3224 ;; Just as a real defvar would, but only in top-level forms.
3225 (list 'setq var value) 3225 (when (null byte-compile-current-form)
3226 (list 'or (list 'boundp (list 'quote var)) 3226 `(push ',var current-load-list))
3227 (list 'setq var value)))) 3227 (when (and string (null byte-compile-current-form))
3228 ;; Put the defined variable in this library's load-history entry 3228 `(put ',var 'variable-documentation ,string))
3229 ;; just as a real defvar would. 3229 (if (cdr (cdr form))
3230 (list 'setq 'current-load-list 3230 (if (eq (car form) 'defconst)
3231 (list 'cons (list 'quote var) 3231 `(setq ,var ,value)
3232 'current-load-list)) 3232 `(if (boundp ',var) ',var (setq ,var ,value))))))))
3233 (if string
3234 (list 'put (list 'quote var) ''variable-documentation string))
3235 (list 'quote var)))))
3236 3233
3237 (defun byte-compile-autoload (form) 3234 (defun byte-compile-autoload (form)
3238 (and (byte-compile-constp (nth 1 form)) 3235 (and (byte-compile-constp (nth 1 form))
3239 (byte-compile-constp (nth 5 form)) 3236 (byte-compile-constp (nth 5 form))
3240 (eval (nth 5 form)) ; macro-p 3237 (eval (nth 5 form)) ; macro-p