moving machines

This commit is contained in:
Robby Findler 2010-08-06 09:03:52 -05:00
parent 2347568a6c
commit 73177ceddc

View File

@ -341,13 +341,16 @@
(define-for-syntax (add-eres-lets an-istx res-proj-vars arg/res-to-indy-var stx)
(cond
[(ormap eres? (istx-ress an-istx))
(with-syntax ([(vars ...) (map arg/res-var (istx-ress an-istx))]
[(rhs ...) (map (λ (res-proj-var res)
#`(#,res-proj-var #,@(map arg/res-to-indy-var (arg/res-vars res))))
(vector->list res-proj-vars)
(istx-ress an-istx))])
#`(let ([vars rhs] ...) #,stx))]
;; WRONG: this needs to use its own, new set of variables
[(and (istx-ress an-istx)
(ormap eres? (istx-ress an-istx)))
(for/fold ([body stx])
([an-arg/res (in-list (reverse (istx-ress an-istx)))]
[res-proj-var (in-vector res-proj-vars (- (vector-length res-proj-vars) 1) -1 -1)])
(if (arg/res-vars an-arg/res)
#`(let ([#,(arg/res-var an-arg/res) (#,res-proj-var #,@(map arg/res-to-indy-var (arg/res-vars an-arg/res)))])
#,body)
body))]
[else stx]))
(define-for-syntax (mk-wrapper-func an-istx used-indy-vars)