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.
Since `#lang errortrace' annotates the result of `local-expand',
it needs to handle `letrec-syntaxes+values', as well as allowing
`#%expression' in more places.
This change relies on a change to `kernel-syntax-case'. This
isn't a new bug, and it's ok to not include it in 5.1.2
(especially since the `kernel-syntax-case' change should not be
merged).
The `eq?'ness of syntax objects used to reconstruct the result
was broken by disarming. The solution is to reconstruct based
on the disarmed syntax object instead of the original.
Merge to 5.1.2.
`test-covered' to use just the expression -- looks like there's no
reason to use an additional key.
Also, change its uses to map each syntax to an mcons where its mcar is
used to track coverage. This is done everywhere, since it turns out to
be much faster to insert a `set-mcar!' with a 3d mpair, rather than a
call to a thunk.
Note that it still uses mpairs as a hack. It "works" in the same way
that this simplified example does:
(define-syntax m
(let ([b (mcons 0 0)])
(lambda (stx)
(with-syntax ([b b])
#'(case-lambda [() (mcar b)]
[(x) (set-mcar! b x)])))))
I think that it's fragile, and likely to stop working at some point, but
I don't see anything better for now.