1
1
mirror of https://github.com/kanaka/mal.git synced 2024-09-11 13:55:55 +03:00

fix atoms not leaking out of let*

This was some ironic happenstance
This commit is contained in:
AnotherTest 2020-01-16 07:32:22 +03:30
parent d40f588823
commit 6b0d8c8d81
6 changed files with 6 additions and 18 deletions

View File

@ -176,19 +176,7 @@ def env_req(env; key):
def env_set(env; $key; $value):
(if $value.kind == "function" or $value.kind == "atom" then
# inform the function/atom of its names
$value | (.names += [$key]) | (.names |= unique) |
if $value.kind == "atom" then
# check if the one we have is newer
env_req(env; $key) as $ours |
if $ours.last_modified > $value.last_modified then
$ours
else
# update modification timestamp
$value | .last_modified |= now
end
else
.
end
$value | (.names += [$key]) | (.names |= unique)
else
$value
end) as $value | {

View File

@ -115,7 +115,7 @@ def EVAL(env):
($value[2] | find_free_references($currentEnv | env_dump_keys + $binds)) as $free_referencess | {
kind: "function",
binds: $binds,
env: (env | env_remove_references($free_referencess)),
env: ($_menv | env_remove_references($free_referencess)),
body: $value[2],
names: [], # we can't do that circular reference thing
free_referencess: $free_referencess # for dynamically scoped variables

View File

@ -149,7 +149,7 @@ def EVAL(env):
($value[2] | find_free_references($currentEnv | env_dump_keys + $binds)) as $free_referencess | {
kind: "function",
binds: $binds,
env: (env | env_remove_references($free_referencess)),
env: ($_menv | env_remove_references($free_referencess)),
body: $value[2],
names: [], # we can't do that circular reference thing
free_referencess: $free_referencess # for dynamically scoped variables

View File

@ -241,7 +241,7 @@ def EVAL(env):
($value[2] | find_free_references($currentEnv | env_dump_keys + $binds)) as $free_referencess | {
kind: "function",
binds: $binds,
env: (env | env_remove_references($free_referencess)),
env: ($_menv | env_remove_references($free_referencess)),
body: $value[2],
names: [], # we can't do that circular reference thing
free_referencess: $free_referencess, # for dynamically scoped variables

View File

@ -270,7 +270,7 @@ def EVAL(env):
($value[2] | find_free_references($currentEnv | env_dump_keys + $binds)) as $free_referencess | {
kind: "function",
binds: $binds,
env: (env | env_remove_references($free_referencess)),
env: ($_menv | env_remove_references($free_referencess)),
body: $value[2],
names: [], # we can't do that circular reference thing
free_referencess: $free_referencess, # for dynamically scoped variables

View File

@ -276,7 +276,7 @@ def EVAL(env):
($value[2] | find_free_references($currentEnv | env_dump_keys + $binds)) as $free_referencess | {
kind: "function",
binds: $binds,
env: $_menv,
env: ($_menv | env_remove_references($free_referencess)),
body: $value[2],
names: [], # we can't do that circular reference thing
free_referencess: $free_referencess, # for dynamically scoped variables