commit 3bcff8e3d13958b16687afdd8bf1e3f012e1870c
parent ddc9d3e953d4643148e2223e9acd03f6be129f58
Author: Ryan Culpepper <ryanc@racket-lang.org>
Date: Thu, 24 Jun 2010 17:33:14 -0600
macro-stepper: clarified "from" in hiding rules, added todo list
original commit: a91e9e7bf630a9a6ee35adaf61f58f56d268b200
Diffstat:
2 files changed, 25 insertions(+), 7 deletions(-)
diff --git a/collects/macro-debugger/util/mpi.rkt b/collects/macro-debugger/util/mpi.rkt
@@ -1,9 +1,12 @@
#lang scheme/base
-(require scheme/match)
+(require scheme/match
+ scheme/string)
(provide mpi->list
- mpi->string)
+ mpi->string
+ self-mpi?)
+;; mpi->list : module-path-index -> list
(define (mpi->list mpi)
(cond [(module-path-index? mpi)
(let-values ([(path relto) (module-path-index-split mpi)])
@@ -18,12 +21,16 @@
(if (module-path-index? mpi)
(let ([mps (mpi->list mpi)])
(cond [(pair? mps)
- (apply string-append
- (format "~s" (car mps))
- (map (lambda (x) (format " <= ~s" x)) (cdr mps)))]
+ (string-join (map (lambda (x) (format "~s" x)) mps)
+ " <= ")]
[(null? mps) "this module"]))
(format "~s" mpi)))
+;; self-mpi? : module-path-index -> bool
+(define (self-mpi? mpi)
+ (let-values ([(path relto) (module-path-index-split mpi)])
+ (eq? path #f)))
+
;; --
(provide mpi->mpi-sexpr
diff --git a/collects/macro-debugger/view/hiding-panel.rkt b/collects/macro-debugger/view/hiding-panel.rkt
@@ -16,6 +16,15 @@
(define mode:standard "Standard")
(define mode:custom "Custom ...")
+#|
+
+TODO
+
+ - allow entry of more policies
+ - visual feedback on rules applying to selected identifier
+ (need to switch from list to editor)
+
+|#
;; macro-hiding-prefs-widget%
(define macro-hiding-prefs-widget%
@@ -255,11 +264,13 @@
(match condition
[`(free=? ,id)
(let ([b (identifier-binding id)])
- (or #;(identifier->string id)
+ (or #| (identifier->string id) |#
(cond [(list? b)
(let ([mod (caddr b)]
[name (cadddr b)])
- (format "'~s' from ~a" name (mpi->string mod)))]
+ (if (self-mpi? mod)
+ (format "'~a' defined in this module" name)
+ (format "'~s' imported from ~a" name (mpi->string mod))))]
[else
(symbol->string (syntax-e id))])))]
[_