From 73177ceddc48c7572687ae23ede740e21e0434df Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Fri, 6 Aug 2010 09:03:52 -0500 Subject: [PATCH] moving machines --- collects/racket/contract/private/arr-i.rkt | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/collects/racket/contract/private/arr-i.rkt b/collects/racket/contract/private/arr-i.rkt index 102a30900d..040aa7ba12 100644 --- a/collects/racket/contract/private/arr-i.rkt +++ b/collects/racket/contract/private/arr-i.rkt @@ -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)