Add debugging parameter, and wrappers for unstable/debug.

original commit: eaa63f2d1ef6c0fdec45b504aa6f2f7bcd07b2b5
This commit is contained in:
Sam Tobin-Hochstadt 2011-04-19 15:46:19 -04:00
parent 70e0482625
commit c11338c883
2 changed files with 8 additions and 3 deletions

View File

@ -57,7 +57,8 @@
(do-time "Local Expand Done")
(parameterize ([mutated-vars (find-mutated-vars fully-expanded-stx)]
[orig-module-stx (or (orig-module-stx) orig-stx)]
[expanded-module-stx fully-expanded-stx])
[expanded-module-stx fully-expanded-stx]
[debugging? #f])
(let ([result (checker fully-expanded-stx)])
(do-time "Typechecking Done")
. body)))))))

View File

@ -7,11 +7,11 @@ at least theoretically.
(require (for-syntax racket/base syntax/parse racket/string)
racket/contract racket/require-syntax
racket/provide-syntax racket/unit
racket/provide-syntax racket/unit (prefix-in d: unstable/debug)
racket/pretty mzlib/pconvert syntax/parse)
;; to move to unstable
(provide reverse-begin list-update list-set)
(provide reverse-begin list-update list-set debugf debugging? dprintf)
(provide
;; optimization
@ -226,3 +226,7 @@ at least theoretically.
(if (zero? k)
(cons v (cdr l))
(cons (car l) (list-set (cdr l) (sub1 k) v))))
(define debugging? (make-parameter #f))
(define-syntax-rule (debugf f . args) (if (debugging?) (d:debugf f . args) (f . args)))
(define (dprintf . args) (when (debugging?) (apply d:dprintf args)))