From 451961e596d412e0f2a1b29b8d593ca85dc2eaad Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 25 May 2010 19:08:53 -0600 Subject: [PATCH] fix `for' to track inlined sequence generators via 'disappeared-use --- collects/racket/private/for.rkt | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/collects/racket/private/for.rkt b/collects/racket/private/for.rkt index 1a48248a21..585324b6b1 100644 --- a/collects/racket/private/for.rkt +++ b/collects/racket/private/for.rkt @@ -175,11 +175,17 @@ [certifier (sequence-transformer-ref m 2)]) (let ([xformed (xformer (introducer (syntax-local-introduce clause)))]) (if xformed - (expand-clause orig-stx (certify-clause (syntax-case clause () + (let ([r (expand-clause orig-stx + (certify-clause (syntax-case clause () [(_ rhs) #'rhs]) (syntax-local-introduce (introducer xformed)) certifier - introducer)) + introducer))]) + (syntax-property r + 'disappeared-use + (cons (syntax-local-introduce #'form) + (or (syntax-property r 'disappeared-use) + null)))) (eloop #f)))))] [[(id ...) (:do-in . body)] (syntax-case #'body () @@ -809,8 +815,12 @@ [(frm [orig-stx nested? #f binds] ([fold-var fold-init] ...) (clause . rest) . body) (with-syntax ([bind (expand-clause #'orig-stx #'clause)]) - #`(frm [orig-stx nested? nested? (bind . binds)] - ([fold-var fold-init] ...) rest . body))] + (let ([r #`(frm [orig-stx nested? nested? (bind . binds)] + ([fold-var fold-init] ...) rest . body)] + [d (syntax-property #'bind 'disappeared-use)]) + (if d + (syntax-property r 'disappeared-use d) + r)))] [(_ [orig-stx . _] . _) (raise-syntax-error #f "bad syntax" #'orig-stx)]))