diff options
author | tomsmeding <tom.smeding@gmail.com> | 2019-11-18 19:40:36 +0100 |
---|---|---|
committer | tomsmeding <tom.smeding@gmail.com> | 2019-11-18 19:40:36 +0100 |
commit | 205893bf518c8d40d16c3efbaf2dde441805a383 (patch) | |
tree | 6a3afb9f90d17e44aee0d698830aae6cf0177c2c | |
parent | 6b968c123b25cda9309768a9186b07997d50c92a (diff) |
Proper depth counting in presence of lets in analyseValue
-rw-r--r-- | Compiler.hs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Compiler.hs b/Compiler.hs index b221694..922528c 100644 --- a/Compiler.hs +++ b/Compiler.hs @@ -75,8 +75,9 @@ analyseValue = go (Map.empty, 0) VQuoted value -> TVQuoted value VDefine name value -> TVDefine name (go env value) VLambda args body -> - let t = go (foldr (flip Map.insert depth) envd args, depth + 1) body - in TVLambda args t (Set.toList (collectEscapes depth t)) + let depth' = depth + 1 + t = go (foldr (flip Map.insert depth') envd args, depth') body + in TVLambda args t (Set.toList (collectEscapes depth' t)) VLet ((name, value) : args) body -> TVLet (name, go (envd, depth) value) (go (Map.insert name depth envd, depth) (VLet args body)) |