Added reset?
option to print-full-scopes
This commit is contained in:
parent
1b249efb87
commit
6198ba2c3c
|
@ -64,13 +64,18 @@
|
||||||
|
|
||||||
(foo (list 123))]}
|
(foo (list 123))]}
|
||||||
|
|
||||||
@defproc[(print-full-scopes) void?]{ Prints the long scope id and annotation
|
@defproc[(print-full-scopes [reset? any/c #t]) void?]{ Prints the long scope id
|
||||||
for all scopes displayed as part of preceeding calls to @racket[+scopes], as
|
and annotation for all scopes displayed as part of preceeding calls to
|
||||||
would be shown by @racket[(hash-ref (syntax-debug-info stx) 'context)].
|
@racket[+scopes], as would be shown by
|
||||||
|
@racket[(hash-ref (syntax-debug-info stx) 'context)].
|
||||||
|
|
||||||
This allows to get some extended information about the scopes in a summary
|
This allows to get some extended information about the scopes in a summary
|
||||||
table by calling @racket[print-full-scopes], while still getting short and
|
table by calling @racket[print-full-scopes], while still getting short and
|
||||||
readable display of syntax objects with @racket[+scopes].}
|
readable display of syntax objects with @racket[+scopes].
|
||||||
|
|
||||||
|
After running @racket[(print-full-scopes)], if @racket[reset?] is true, then
|
||||||
|
the scope counter is reset (and @racket[+scopes] therefore starts numbering
|
||||||
|
scopes starting from @racket[0] again).}
|
||||||
|
|
||||||
@section{Hack for named scopes}
|
@section{Hack for named scopes}
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
(define max-seen-scopes 0)
|
(define max-seen-scopes 0)
|
||||||
(define seen-scopes (make-hash))
|
(define seen-scopes (make-hash))
|
||||||
|
|
||||||
(define (print-full-scopes)
|
(define (print-full-scopes [reset? #t])
|
||||||
(define scopes (sort (hash->list seen-scopes) < #:key cadr))
|
(define scopes (sort (hash->list seen-scopes) < #:key cadr))
|
||||||
(define l
|
(define l
|
||||||
(map (λ (s)
|
(map (λ (s)
|
||||||
|
@ -30,8 +30,9 @@
|
||||||
(vector-ref (cddr s) 0)))
|
(vector-ref (cddr s) 0)))
|
||||||
scopes
|
scopes
|
||||||
l)
|
l)
|
||||||
(hash-clear! seen-scopes)
|
(when reset?
|
||||||
(set! max-seen-scopes 0))
|
(hash-clear! seen-scopes)
|
||||||
|
(set! max-seen-scopes 0)))
|
||||||
|
|
||||||
(define (string-replace* str replacements)
|
(define (string-replace* str replacements)
|
||||||
(if (null? replacements)
|
(if (null? replacements)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user