1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 13:21:59 +03:00

Close over a smaller environment.

This commit is contained in:
Rob Rix 2018-03-14 12:31:34 -04:00
parent a0071fc768
commit 9742978154

View File

@ -131,7 +131,8 @@ continue = do
maybe (fail "free loop variable") deref (envLookup (name "loop") env)
-- | Construct a 'Value' wrapping the value arguments (if any).
instance ( MonadAddressable location (Value location term) m
instance ( FreeVariables term
, MonadAddressable location (Value location term) m
, MonadAnalysis term (Value location term) m
, Show location
, Show term
@ -193,7 +194,7 @@ instance ( MonadAddressable location (Value location term) m
pair = (left, right)
abstract names (Subterm body _) = injValue . Closure names body <$> askLocalEnv
abstract names (Subterm body _) = injValue . Closure names body . bindEnv (freeVariables body) <$> askLocalEnv
apply op params = do
Closure names body env <- maybe (fail ("expected a closure, got: " <> show op)) pure (prjValue op)