From 82aed89fa488bfe31158b404d43f7bfa4c4beb4d Mon Sep 17 00:00:00 2001 From: Ryan Culpepper Date: Fri, 15 Jan 2010 21:33:36 +0000 Subject: [PATCH] macro-stepper: yet another local-expansion fix svn: r17668 original commit: 6eb51f94020ddaad0e0e907d98a5f741f06012e5 --- .../macro-debugger/model/reductions-engine.ss | 16 ++++++++++++---- collects/macro-debugger/model/reductions.ss | 17 +++++++---------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/collects/macro-debugger/model/reductions-engine.ss b/collects/macro-debugger/model/reductions-engine.ss index c656117..9c89829 100644 --- a/collects/macro-debugger/model/reductions-engine.ss +++ b/collects/macro-debugger/model/reductions-engine.ss @@ -336,10 +336,18 @@ (k f v s ws)))] [(R** f v p s ws [#:new-local-context clause ...] . more) - ;; Note: pass no left-state to subclauses, - ;; then discard result state, restore s when return. - #'(RSbind (with-new-local-context v (R** f v p #f ws clause ...)) - (lambda (f2 v2 s2 ws2) (R** f2 v2 p s ws2 . more)))] + ;; If vis = #t, then (clause ...) do not affect local config + ;; If vis = #f, then proceed normally + ;; *except* must save & restore real term + #'(let* ([vis (visibility)] + [process-clauses (lambda () (R** #f (if vis #f v) _ #f ws clause ...))]) + (RSbind (if vis + (with-new-local-context v (process-clauses)) + (process-clauses)) + (lambda (f2 v2 s2 ws2) + (let ([v2 (if vis v v2)] + [s2 (if vis s s2)]) + (R** f v2 p s2 ws2 . more)))))] ;; Subterm handling [(R** f v p s ws [reducer hole fill] . more) diff --git a/collects/macro-debugger/model/reductions.ss b/collects/macro-debugger/model/reductions.ss index 46efb52..e8ded61 100644 --- a/collects/macro-debugger/model/reductions.ss +++ b/collects/macro-debugger/model/reductions.ss @@ -360,16 +360,13 @@ (R)] [(cons local rest) (R [#:pattern ?form] - [#:if (visibility) - ;; If macro with local-expand is transparent, - ;; then all local-expansions must be transparent. - ([#:parameterize ((macro-policy (lambda _ #t))) - [#:new-local-context - [LocalAction ?form local]]]) - ([#:pass1] - ;; Use ?disconnected; do not modify real term - [LocalAction ?disconnected local] - [#:pass2])] + [#:parameterize ((macro-policy + ;; If macro with local-expand is transparent, + ;; then all local-expansions must be transparent. + (if (visibility) (lambda _ #t) (macro-policy)))) + [#:new-local-context + [#:pattern ?form] + [LocalAction ?form local]]] [LocalActions ?form rest])])) (define (LocalAction local)