1
1
mirror of https://github.com/github/semantic.git synced 2024-11-28 10:15:55 +03:00

Use the env effect in the concrete analysis.

This commit is contained in:
Rob Rix 2019-11-01 15:12:36 -04:00
parent 06ea57e167
commit e58db3da31
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -11,7 +11,7 @@ module Analysis.Concrete
import qualified Algebra.Graph as G import qualified Algebra.Graph as G
import qualified Algebra.Graph.Export.Dot as G import qualified Algebra.Graph.Export.Dot as G
import qualified Analysis.Analysis as A import Analysis.Analysis
import qualified Analysis.Carrier.Env.Precise as A import qualified Analysis.Carrier.Env.Precise as A
import Analysis.File import Analysis.File
import Control.Applicative (Alternative (..)) import Control.Applicative (Alternative (..))
@ -75,7 +75,7 @@ concrete
) )
=> (forall sig m => (forall sig m
. (Carrier sig m, Member (Reader Path.AbsRelFile) sig, Member (Reader Span) sig, MonadFail m) . (Carrier sig m, Member (Reader Path.AbsRelFile) sig, Member (Reader Span) sig, MonadFail m)
=> A.Analysis term name Precise (Concrete term name) m => Analysis term name Precise (Concrete term name) m
-> (term name -> m (Concrete term name)) -> (term name -> m (Concrete term name))
-> (term name -> m (Concrete term name)) -> (term name -> m (Concrete term name))
) )
@ -101,7 +101,7 @@ runFile
) )
=> (forall sig m => (forall sig m
. (Carrier sig m, Member (Reader Path.AbsRelFile) sig, Member (Reader Span) sig, MonadFail m) . (Carrier sig m, Member (Reader Path.AbsRelFile) sig, Member (Reader Span) sig, MonadFail m)
=> A.Analysis term name Precise (Concrete term name) m => Analysis term name Precise (Concrete term name) m
-> (term name -> m (Concrete term name)) -> (term name -> m (Concrete term name))
-> (term name -> m (Concrete term name)) -> (term name -> m (Concrete term name))
) )
@ -118,7 +118,7 @@ runFile eval file = traverse run file
concreteAnalysis :: ( Carrier sig m concreteAnalysis :: ( Carrier sig m
, Foldable term , Foldable term
, IsString name , IsString name
, Member Fresh sig , Member (A.Env name Precise) sig
, Member (Reader (Env name)) sig , Member (Reader (Env name)) sig
, Member (Reader Path.AbsRelFile) sig , Member (Reader Path.AbsRelFile) sig
, Member (Reader Span) sig , Member (Reader Span) sig
@ -128,11 +128,11 @@ concreteAnalysis :: ( Carrier sig m
, Show name , Show name
, Show (term name) , Show (term name)
) )
=> A.Analysis term name Precise (Concrete term name) m => Analysis term name Precise (Concrete term name) m
concreteAnalysis = A.Analysis{..} concreteAnalysis = Analysis{..}
where alloc _ = fresh where alloc = A.alloc
bind name addr m = local (Map.insert name addr) m bind = A.bind
lookupEnv n = asks (Map.lookup n) lookupEnv = A.lookupEnv
deref = gets . IntMap.lookup deref = gets . IntMap.lookup
assign addr value = modify (IntMap.insert addr value) assign addr value = modify (IntMap.insert addr value)
abstract _ name body = do abstract _ name body = do