[MLton-commit] r5715
Vesa Karvonen
vesak at mlton.org
Mon Jul 2 06:04:21 PDT 2007
Move latest matching def-use source to the front. This improves accuracy
when multiple sources are being used.
----------------------------------------------------------------------
U mlton/trunk/ide/emacs/def-use-data.el
----------------------------------------------------------------------
Modified: mlton/trunk/ide/emacs/def-use-data.el
===================================================================
--- mlton/trunk/ide/emacs/def-use-data.el 2007-07-02 11:00:02 UTC (rev 5714)
+++ mlton/trunk/ide/emacs/def-use-data.el 2007-07-02 13:04:20 UTC (rev 5715)
@@ -121,17 +121,36 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Queries
+(defun def-use-query (fn)
+ "Queries the def-use -sources with the given function and moves the
+satisfied dus to the front."
+ (let ((prev nil)
+ (work def-use-dus-list)
+ (result nil))
+ (while (and work
+ (not (setq result (funcall fn (car work)))))
+ (setq prev work)
+ (setq work (cdr work)))
+ (when (and prev work)
+ (setcdr prev (cdr work))
+ (setcdr work def-use-dus-list)
+ (setq def-use-dus-list work)
+ (def-use-show-dus-update))
+ result))
+
(defun def-use-sym-at-ref (ref)
(when ref
- (loop for dus in def-use-dus-list do
- (let ((it (def-use-dus-sym-at-ref dus ref)))
- (when it (return it))))))
+ (def-use-query
+ (function
+ (lambda (dus)
+ (def-use-dus-sym-at-ref dus ref))))))
(defun def-use-sym-to-uses (sym)
(when sym
- (loop for dus in def-use-dus-list do
- (let ((it (def-use-dus-sym-to-uses dus sym)))
- (when it (return it))))))
+ (def-use-query
+ (function
+ (lambda (dus)
+ (def-use-dus-sym-to-uses dus sym))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
More information about the MLton-commit
mailing list