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:
parent
d40f588823
commit
6b0d8c8d81
14
jq/env.jq
14
jq/env.jq
@ -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 | {
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user