908 |
;; list. If our current position is after the symbol's position, we |
;; list. If our current position is after the symbol's position, we |
909 |
;; assume we've already passed that point, and look for the next |
;; assume we've already passed that point, and look for the next |
910 |
;; occurrence of the symbol. |
;; occurrence of the symbol. |
911 |
|
;; |
912 |
|
;; This function should not be called twice for the same occurrence of |
913 |
|
;; a symbol, and it should not be called for symbols generated by the |
914 |
|
;; byte compiler itself; because rather than just fail looking up the |
915 |
|
;; symbol, we may find an occurrence of the symbol further ahead, and |
916 |
|
;; then `byte-compile-last-position' as advanced too far. |
917 |
|
;; |
918 |
;; So your're probably asking yourself: Isn't this function a |
;; So your're probably asking yourself: Isn't this function a |
919 |
;; gross hack? And the answer, of course, would be yes. |
;; gross hack? And the answer, of course, would be yes. |
920 |
(defun byte-compile-set-symbol-position (sym &optional allow-previous) |
(defun byte-compile-set-symbol-position (sym &optional allow-previous) |
2311 |
',name ',declaration)) |
',name ',declaration)) |
2312 |
outbuffer))))) |
outbuffer))))) |
2313 |
|
|
2314 |
(let* ((new-one (byte-compile-lambda (cons 'lambda (nthcdr 2 form)))) |
(let* ((new-one (byte-compile-lambda (nthcdr 2 form) t)) |
2315 |
(code (byte-compile-byte-code-maker new-one))) |
(code (byte-compile-byte-code-maker new-one))) |
2316 |
(if this-one |
(if this-one |
2317 |
(setcdr this-one new-one) |
(setcdr this-one new-one) |
2507 |
;; Byte-compile a lambda-expression and return a valid function. |
;; Byte-compile a lambda-expression and return a valid function. |
2508 |
;; The value is usually a compiled function but may be the original |
;; The value is usually a compiled function but may be the original |
2509 |
;; lambda-expression. |
;; lambda-expression. |
2510 |
(defun byte-compile-lambda (fun) |
;; When ADD-LAMBDA is non-nil, the symbol `lambda' is added as head |
2511 |
(unless (eq 'lambda (car-safe fun)) |
;; of the list FUN and `byte-compile-set-symbol-position' is not called. |
2512 |
(error "Not a lambda list: %S" fun)) |
;; Use this feature to avoid calling `byte-compile-set-symbol-position' |
2513 |
(byte-compile-set-symbol-position 'lambda) |
;; for symbols generated by the byte compiler itself. |
2514 |
|
(defun byte-compile-lambda (fun &optional add-lambda) |
2515 |
|
(if add-lambda |
2516 |
|
(setq fun (cons 'lambda fun)) |
2517 |
|
(unless (eq 'lambda (car-safe fun)) |
2518 |
|
(error "Not a lambda list: %S" fun)) |
2519 |
|
(byte-compile-set-symbol-position 'lambda)) |
2520 |
(byte-compile-check-lambda-list (nth 1 fun)) |
(byte-compile-check-lambda-list (nth 1 fun)) |
2521 |
(let* ((arglist (nth 1 fun)) |
(let* ((arglist (nth 1 fun)) |
2522 |
(byte-compile-bound-variables |
(byte-compile-bound-variables |
2768 |
(or (not (byte-compile-version-cond |
(or (not (byte-compile-version-cond |
2769 |
byte-compile-compatibility)) |
byte-compile-compatibility)) |
2770 |
(not (get (get fn 'byte-opcode) 'emacs19-opcode)))) |
(not (get (get fn 'byte-opcode) 'emacs19-opcode)))) |
2771 |
(progn |
(funcall handler form) |
|
(byte-compile-set-symbol-position fn) |
|
|
(funcall handler form)) |
|
2772 |
(when (memq 'callargs byte-compile-warnings) |
(when (memq 'callargs byte-compile-warnings) |
2773 |
(if (memq fn '(custom-declare-group custom-declare-variable custom-declare-face)) |
(if (memq fn '(custom-declare-group custom-declare-variable custom-declare-face)) |
2774 |
(byte-compile-nogroup-warn form)) |
(byte-compile-nogroup-warn form)) |
3682 |
(list 'fset |
(list 'fset |
3683 |
(list 'quote (nth 1 form)) |
(list 'quote (nth 1 form)) |
3684 |
(byte-compile-byte-code-maker |
(byte-compile-byte-code-maker |
3685 |
(byte-compile-lambda (cons 'lambda (cdr (cdr form))))))) |
(byte-compile-lambda (cdr (cdr form)) t)))) |
3686 |
(byte-compile-discard)) |
(byte-compile-discard)) |
3687 |
;; We prefer to generate a defalias form so it will record the function |
;; We prefer to generate a defalias form so it will record the function |
3688 |
;; definition just like interpreting a defun. |
;; definition just like interpreting a defun. |
3690 |
(list 'defalias |
(list 'defalias |
3691 |
(list 'quote (nth 1 form)) |
(list 'quote (nth 1 form)) |
3692 |
(byte-compile-byte-code-maker |
(byte-compile-byte-code-maker |
3693 |
(byte-compile-lambda (cons 'lambda (cdr (cdr form)))))) |
(byte-compile-lambda (cdr (cdr form)) t))) |
3694 |
t)) |
t)) |
3695 |
(byte-compile-constant (nth 1 form))) |
(byte-compile-constant (nth 1 form))) |
3696 |
|
|
3699 |
(byte-compile-body-do-effect |
(byte-compile-body-do-effect |
3700 |
(list (list 'fset (list 'quote (nth 1 form)) |
(list (list 'fset (list 'quote (nth 1 form)) |
3701 |
(let ((code (byte-compile-byte-code-maker |
(let ((code (byte-compile-byte-code-maker |
3702 |
(byte-compile-lambda |
(byte-compile-lambda (cdr (cdr form)) t)))) |
|
(cons 'lambda (cdr (cdr form))))))) |
|
3703 |
(if (eq (car-safe code) 'make-byte-code) |
(if (eq (car-safe code) 'make-byte-code) |
3704 |
(list 'cons ''macro code) |
(list 'cons ''macro code) |
3705 |
(list 'quote (cons 'macro (eval code)))))) |
(list 'quote (cons 'macro (eval code)))))) |