diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-03-23 06:38:42 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-03-23 06:38:42 -0700 |
commit | 73784f852159b14c42024bb2451c4c83067f4d6c (patch) | |
tree | 78f43df54d16d2c9c6e55120db9ac2785134d5ea /vm.c | |
parent | 95b4df1578734e04dd45c553ed4545a5f1f9e372 (diff) | |
download | txr-73784f852159b14c42024bb2451c4c83067f4d6c.tar.gz txr-73784f852159b14c42024bb2451c4c83067f4d6c.tar.bz2 txr-73784f852159b14c42024bb2451c4c83067f4d6c.zip |
compiler: streamline tree-case
The setting of an error variable upon destructuring mismatch
is not useful; it just takes extra instructions to check for a
colon return out of the body or that variable being set.
Let's have expand-bind-mac-params generate code which
returns that symbol itself of assigning to it. The
caller can then specify : for the strict parameter. A
destructuring mismatch turns into a : return value, exactly
the same as the value which indicates "fall through to next
case".
* share/txr/stdlib/compiler.tl (compiler comp-tree-case):
Don't generate the err-var; remove all references to it.
Pass : to expand-bind-mac-params as the strict parameter,
rather than err-var.sym. Generate much simplified code
after the cfrag: just test for a colon and continue
through to the next case or else branch to the end.
In the last case, the fall through path precipiates to the
end, so we insert an instruction to clobber the : in the
return register with a nil.
(expand-bind-mac-params): Eliminate assignments to strict;
it doesn't function as a variable any longer. Return
that symbol in the return-from forms.
Diffstat (limited to 'vm.c')
0 files changed, 0 insertions, 0 deletions