syntax/parse: trim txlifts helper module

This commit is contained in:
Ryan Culpepper 2016-07-31 12:37:52 -04:00
parent 0a7d97df86
commit 6fe55ec307

View File

@ -1,14 +1,13 @@
#lang racket/base #lang racket/base
(require (for-template racket/base)) (require (for-template racket/base))
(provide txlift (provide txlift
get-txlifts
get-txlifts-as-definitions get-txlifts-as-definitions
call/txlifts
with-txlifts with-txlifts
with-txlifts/defs) call/txlifts)
;; Like lifting definitions, but within a single transformer. ;; Like lifting definitions, but within a single transformer.
;; current-liftbox : Parameter of [#f or (Listof (list Id Stx))]
(define current-liftbox (make-parameter #f)) (define current-liftbox (make-parameter #f))
(define (call/txlifts proc) (define (call/txlifts proc)
@ -44,10 +43,3 @@
(let ([v (proc)]) (let ([v (proc)])
(with-syntax ([((var rhs) ...) (get-txlifts)]) (with-syntax ([((var rhs) ...) (get-txlifts)])
#`(let* ([var rhs] ...) #,v)))))) #`(let* ([var rhs] ...) #,v))))))
(define (with-txlifts/defs proc)
(call/txlifts
(lambda ()
(let ([v (proc)])
(with-syntax ([(def ...) (get-txlifts-as-definitions)])
#`(begin def ... #,v))))))