1
1
mirror of https://github.com/github/semantic.git synced 2024-12-24 23:42:31 +03:00

Only close over the free variables.

This commit is contained in:
Rob Rix 2019-07-22 12:07:51 -04:00
parent 2a600397b2
commit d29928827d
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -28,6 +28,7 @@ import qualified Data.IntSet as IntSet
import Data.Loc
import qualified Data.Map as Map
import Data.Name
import qualified Data.Set as Set
import Data.Term
import Data.Text (Text, pack)
import Data.Traversable (for)
@ -99,7 +100,7 @@ concreteAnalysis = Analysis{..}
assign addr value = modify (IntMap.insert addr value)
abstract _ name body = do
loc <- ask
env <- ask
env <- asks (flip Map.restrictKeys (Set.delete name (foldMap Set.singleton body)))
pure (Closure loc name body env)
apply eval (Closure loc name body env) a = do
local (const loc) $ do