1
1
mirror of https://github.com/github/semantic.git synced 2024-12-21 05:41:54 +03:00

Move askRoots/extraRoots into Evaluator.

This commit is contained in:
Rob Rix 2018-04-25 18:05:07 -04:00
parent 87f2f982ff
commit 8d11219264
2 changed files with 15 additions and 9 deletions

View File

@ -42,15 +42,6 @@ instance ( Effectful m
analyzeModule = liftAnalyze analyzeModule
-- | Retrieve the local 'Live' set.
askRoots :: (Effectful m, Member (Reader (Live location value)) effects) => m effects (Live location value)
askRoots = raise ask
-- | Run a computation with the given 'Live' set added to the local root set.
-- extraRoots :: (Effectful m, Member (Reader (Live location value)) effects, Ord location) => Live location value -> m effects a -> m effects a
-- extraRoots roots = raise . local (<> roots) . lower
-- | Collect any addresses in the heap not rooted in or reachable from the given 'Live' set.
gc :: ( Ord location
, Foldable (Cell location)

View File

@ -27,6 +27,9 @@ module Control.Abstract.Evaluator
, modifyHeap
, lookupHeap
, assign
-- Roots
, askRoots
, extraRoots
-- Module tables
, getModuleTable
, putModuleTable
@ -59,6 +62,7 @@ import Data.Abstract.Environment as Env
import Data.Abstract.Exports as Export
import Data.Abstract.FreeVariables
import Data.Abstract.Heap
import Data.Abstract.Live
import Data.Abstract.Module
import Data.Abstract.ModuleTable
import Data.Abstract.Package
@ -263,6 +267,17 @@ assign :: ( Ord location
assign address = modifyHeap . heapInsert address
-- Roots
-- | Retrieve the local 'Live' set.
askRoots :: (Effectful m, Member (Reader (Live location value)) effects) => m effects (Live location value)
askRoots = raise ask
-- | Run a computation with the given 'Live' set added to the local root set.
extraRoots :: (Effectful m, Member (Reader (Live location value)) effects, Ord location) => Live location value -> m effects a -> m effects a
extraRoots roots = raiseHandler (local (<> roots))
-- Module table
-- | Retrieve the table of evaluated modules.