From 6abcf2f87b0999036ca966458d5e20f0efc703b3 Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Tue, 20 Sep 2011 13:29:42 -0600 Subject: [PATCH] add `var-ref->mod-decl-insp' and switch `cur-code-insp' uses Macros and other tools that need syntax privilege used `(current-code-inspector)' at the module top-level to try to capture the right code inspector at load time. It's more consistent to instead use the enclosing module's declaration-time inspector, and `var-ref->mod-decl-insp' provides that. The new function works only on references to anonymous variables, which limits access to the inspector. The real function name is longer, of course. original commit: 0197902309c5400d463393829a88282c627dafd2 --- collects/parser-tools/private-lex/stx.rkt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/collects/parser-tools/private-lex/stx.rkt b/collects/parser-tools/private-lex/stx.rkt index 83d610a..f178847 100644 --- a/collects/parser-tools/private-lex/stx.rkt +++ b/collects/parser-tools/private-lex/stx.rkt @@ -28,7 +28,8 @@ ((char-range-arg #'#\1 #'here) (char->integer #\1)) ((char-range-arg #'"1" #'here) (char->integer #\1))) - (define orig-insp (current-code-inspector)) + (define orig-insp (variable-reference->module-declaration-inspector + (#%variable-reference))) (define (disarm stx) (syntax-disarm stx orig-insp))