1 |
;;; bytecomp.el --- compilation of Lisp code into byte code |
;;; bytecomp.el --- compilation of Lisp code into byte code |
2 |
|
|
3 |
;; Copyright (C) 1985,86,87,92,94,1998,2000,01,02,03,2004 |
;; Copyright (C) 1985, 1986, 1987, 1992, 1994, 1998, 2000, 2001, 2002, |
4 |
;; Free Software Foundation, Inc. |
;; 2003, 2004 Free Software Foundation, Inc. |
5 |
|
|
6 |
;; Author: Jamie Zawinski <jwz@lucid.com> |
;; Author: Jamie Zawinski <jwz@lucid.com> |
7 |
;; Hallvard Furuseth <hbf@ulrik.uio.no> |
;; Hallvard Furuseth <hbf@ulrik.uio.no> |
1215 |
(if cons |
(if cons |
1216 |
(or (memq n (cdr cons)) |
(or (memq n (cdr cons)) |
1217 |
(setcdr cons (cons n (cdr cons)))) |
(setcdr cons (cons n (cdr cons)))) |
1218 |
(setq byte-compile-unresolved-functions |
(push (list (car form) n) |
1219 |
(cons (list (car form) n) |
byte-compile-unresolved-functions)))))) |
|
byte-compile-unresolved-functions))))))) |
|
1220 |
|
|
1221 |
(defun byte-compile-format-warn (form) |
(defun byte-compile-format-warn (form) |
1222 |
"Warn if FORM is `format'-like with inconsistent args. |
"Warn if FORM is `format'-like with inconsistent args. |
2128 |
(eq (car (nth 1 form)) 'quote) |
(eq (car (nth 1 form)) 'quote) |
2129 |
(consp (cdr (nth 1 form))) |
(consp (cdr (nth 1 form))) |
2130 |
(symbolp (nth 1 (nth 1 form)))) |
(symbolp (nth 1 (nth 1 form)))) |
2131 |
(add-to-list 'byte-compile-function-environment |
(push (cons (nth 1 (nth 1 form)) |
2132 |
(cons (nth 1 (nth 1 form)) |
(cons 'autoload (cdr (cdr form)))) |
2133 |
(cons 'autoload (cdr (cdr form)))))) |
byte-compile-function-environment)) |
2134 |
(if (stringp (nth 3 form)) |
(if (stringp (nth 3 form)) |
2135 |
form |
form |
2136 |
;; No doc string, so we can compile this as a normal form. |
;; No doc string, so we can compile this as a normal form. |
3613 |
(byte-defop-compiler-1 defconst byte-compile-defvar) |
(byte-defop-compiler-1 defconst byte-compile-defvar) |
3614 |
(byte-defop-compiler-1 autoload) |
(byte-defop-compiler-1 autoload) |
3615 |
(byte-defop-compiler-1 lambda byte-compile-lambda-form) |
(byte-defop-compiler-1 lambda byte-compile-lambda-form) |
|
(byte-defop-compiler-1 defalias) |
|
3616 |
|
|
3617 |
(defun byte-compile-defun (form) |
(defun byte-compile-defun (form) |
3618 |
;; This is not used for file-level defuns with doc strings. |
;; This is not used for file-level defuns with doc strings. |
3714 |
(error "`lambda' used as function name is invalid")) |
(error "`lambda' used as function name is invalid")) |
3715 |
|
|
3716 |
;; Compile normally, but deal with warnings for the function being defined. |
;; Compile normally, but deal with warnings for the function being defined. |
3717 |
(defun byte-compile-defalias (form) |
(put 'defalias 'byte-hunk-handler 'byte-compile-file-form-defalias) |
3718 |
|
(defun byte-compile-file-form-defalias (form) |
3719 |
(if (and (consp (cdr form)) (consp (nth 1 form)) |
(if (and (consp (cdr form)) (consp (nth 1 form)) |
3720 |
(eq (car (nth 1 form)) 'quote) |
(eq (car (nth 1 form)) 'quote) |
3721 |
(consp (cdr (nth 1 form))) |
(consp (cdr (nth 1 form))) |
3727 |
(consp (cdr (nth 2 form))) |
(consp (cdr (nth 2 form))) |
3728 |
(symbolp (nth 1 (nth 2 form)))))) |
(symbolp (nth 1 (nth 2 form)))))) |
3729 |
(byte-compile-defalias-warn (nth 1 (nth 1 form))) |
(byte-compile-defalias-warn (nth 1 (nth 1 form))) |
3730 |
(setq byte-compile-function-environment |
(push (cons (nth 1 (nth 1 form)) |
3731 |
(cons (cons (nth 1 (nth 1 form)) |
(if constant (nth 1 (nth 2 form)) t)) |
3732 |
(if constant (nth 1 (nth 2 form)) t)) |
byte-compile-function-environment))) |
|
byte-compile-function-environment)))) |
|
3733 |
(byte-compile-normal-call form)) |
(byte-compile-normal-call form)) |
3734 |
|
|
3735 |
;; Turn off warnings about prior calls to the function being defalias'd. |
;; Turn off warnings about prior calls to the function being defalias'd. |
4114 |
|
|
4115 |
(run-hooks 'bytecomp-load-hook) |
(run-hooks 'bytecomp-load-hook) |
4116 |
|
|
4117 |
;;; arch-tag: 9c97b0f0-8745-4571-bfc3-8dceb677292a |
;; arch-tag: 9c97b0f0-8745-4571-bfc3-8dceb677292a |
4118 |
;;; bytecomp.el ends here |
;;; bytecomp.el ends here |