;; The purpose of this function is to iterate through the
;; `read-symbol-positions-list'. Each time we process, say, a
;; function definition (`defun') we remove `defun' from
;; `read-symbol-positions-list', and set `byte-compile-last-position'
;; to that symbol's character position. Similarly, if we encounter a
;; variable reference, like in (1+ foo), we remove `foo' from the
;; list. If our current position is after the symbol's position, we
;; assume we've already passed that point, and look for the next
;; occurrence of the symbol.
;;
;; This function should not be called twice for the same occurrence of
;; a symbol, and it should not be called for symbols generated by the
;; byte compiler itself; because rather than just fail looking up the
;; symbol, we may find an occurrence of the symbol further ahead, and
;; then `byte-compile-last-position' as advanced too far.
;;
;; So your're probably asking yourself: Isn't this function a
;; gross hack? And the answer, of course, would be yes.
(defun byte-compile-set-symbol-position (sym &optional allow-previous)
(when byte-compile-read-position
(let (last entry)
(while (progn
(setq last byte-compile-last-position
entry (assq sym read-symbol-positions-list))
(when entry
(setq byte-compile-last-position
(+ byte-compile-read-position (cdr entry))
read-symbol-positions-list
(byte-compile-delete-first
entry read-symbol-positions-list)))
(or (and allow-previous
(not (= last byte-compile-last-position)))
(> last byte-compile-last-position)))))))
Of course.