diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2018-05-25 06:20:13 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2018-05-25 06:20:13 -0700 |
commit | d93139b94b93be5d661b4146fe06cd31f837f22b (patch) | |
tree | df95a467b1536132ea87b4d13927eab79926f36c /vm.c | |
parent | 3ffeb5ce625fde61fc0e468f9dd2d00528724c78 (diff) | |
download | txr-d93139b94b93be5d661b4146fe06cd31f837f22b.tar.gz txr-d93139b94b93be5d661b4146fe06cd31f837f22b.tar.bz2 txr-d93139b94b93be5d661b4146fe06cd31f837f22b.zip |
compiler: fix wrong free symbol calculations.
Calculation of free symbols emanating out of let, let*, flet
and labels is wrong, not taking into account the differences,
respectively between let and let*, and between flet and
labels. Compilation of lambda also has the same problem;
variable references in initforms are considered free without
regard for shadowing by earlier parameters. Another issue
is the incorrect handling of special variables: special
variable references are incorrectly being considered free
in scopes where they are bound.
* share/txr/stdlib/compiler.tl (compiler comp-let): For
sequential bindings (let*), we must cull the prior variables
from the list of free vars emanating out of each init form;
these references do not emanate out of the binding construct.
We pull the prior vars list out of the environment before
binding the current variable so that it is
not included in the list. Both special and lexical variables
must be considered reference-capturing.
(compiler comp-fbind): If compiling a recursive binding, cull
the newly bound functions from the free references emanating
from the local function bodies. A bug is fixed here that we
were not referring to the correct list of symbols and so not
taking into account the function references inside the local
functions themselves at all.
(compile comp-lambda): Build a correct list of free vars in
relation to the initforms of optional parameters, taking
account the scope, and that special variables capture
references.
Diffstat (limited to 'vm.c')
0 files changed, 0 insertions, 0 deletions