diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2021-01-27 07:52:50 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2021-01-27 07:52:50 -0800 |
commit | b0adac41c9ed37fa2783cbbde7d243f5496ed954 (patch) | |
tree | 5fae88da22dc22d2bf59c1ef9c577c8feb1f92f4 /tests/011 | |
parent | 4b7e799c377d2c4608d1b03f056edd659424a29b (diff) | |
download | txr-b0adac41c9ed37fa2783cbbde7d243f5496ed954.tar.gz txr-b0adac41c9ed37fa2783cbbde7d243f5496ed954.tar.bz2 txr-b0adac41c9ed37fa2783cbbde7d243f5496ed954.zip |
matcher: clean up unclear vars situaton.
With this commit, the new broken test case passes.
The main issue is not clearly separating temporary variables
in mach-guards from public variables.
* share/txr/stdlib/match.tl (match-vars): Remove pure-vars and
pure-var-exprs from this inheritance base, as well as the
related lets method.
(match-guard): Add the "pure" slots here, under new names:
pure-temps and pure-temp-exprs. This renaming is for clarity.
Add the lets method here, based on these new variables.
Add new slots temps, representing the impure temps.
There is no temp-exprs because impure temps are bound
to nil and later assigned.
(compiled-match get-temps): Method removed.
(compiled-match get-vars): Rewritten to avoid using get-temps
which doesn't exist any more. This method has a clear purpose:
to all the public variables coming from the patterns themselves,
whether those variables are promoted into a guard-chain for
early binding or whether they are attached on the
compiled-match object.
(compiled-match wrap-guards): Ensure that the new temps
from the guard-chain objects are bound with let.
(compile-struct-match, compile-vec-match,
compile-range-match, compile-dwim-predicate-match,
compile-cons-structure, compile-hash-match): pure-vars rename.
(compile-loop-match): We no longer bind cm.(get-temps) here.
That method doesn't exist. If we are not doing @(some), we
bind cm-vars: the public vars collected from cm. We need
local copies of them to catch their values and accumulate them
into list. In the match-guard constructor, we move the
collect-gens into temps; they are not public variables.
(compile-parallel-match): Drop ^(let ,pm.(get-temps) ...) from
the expansion.
Diffstat (limited to 'tests/011')
0 files changed, 0 insertions, 0 deletions