mirror of
https://github.com/github/semantic.git
synced 2024-12-24 23:42:31 +03:00
Merge branch 'master' into factor-abstract-value-as-value-effects
This commit is contained in:
commit
812d9cefab
@ -53,7 +53,6 @@ library
|
||||
, Control.Rewriting
|
||||
-- Datatypes for abstract interpretation
|
||||
, Data.Abstract.Address.Hole
|
||||
, Data.Abstract.Address.Located
|
||||
, Data.Abstract.Address.Monovariant
|
||||
, Data.Abstract.Address.Precise
|
||||
, Data.Abstract.BaseError
|
||||
|
@ -20,8 +20,6 @@ import Algebra.Graph.Export.Dot hiding (vertexName)
|
||||
import Control.Abstract hiding (Function(..))
|
||||
import Control.Effect.Carrier
|
||||
import Control.Effect.Sum
|
||||
import Data.Abstract.Address.Hole
|
||||
import Data.Abstract.Address.Located
|
||||
import Data.Abstract.BaseError
|
||||
import Data.Abstract.Declarations
|
||||
import Data.Abstract.Module (Module (moduleInfo), ModuleInfo (..))
|
||||
@ -65,24 +63,22 @@ style = (defaultStyle (T.encodeUtf8Builder . vertexIdentifier))
|
||||
graphingTerms :: ( Member (Reader ModuleInfo) sig
|
||||
, Member (Reader Span) sig
|
||||
, Member (State (Graph ControlFlowVertex)) sig
|
||||
, Member (State (Map (Slot hole) ControlFlowVertex)) sig
|
||||
, Member (State (Heap hole hole value)) sig
|
||||
, Member (State (ScopeGraph (Hole context (Located address)))) sig
|
||||
, Member (Resumable (BaseError (ScopeError hole))) sig
|
||||
, Member (Resumable (BaseError (HeapError hole))) sig
|
||||
, Member (Reader (CurrentFrame hole)) sig
|
||||
, Member (Reader (CurrentScope hole)) sig
|
||||
, Member (State (Map (Slot address) ControlFlowVertex)) sig
|
||||
, Member (State (Heap address address value)) sig
|
||||
, Member (State (ScopeGraph address)) sig
|
||||
, Member (Resumable (BaseError (ScopeError address))) sig
|
||||
, Member (Resumable (BaseError (HeapError address))) sig
|
||||
, Member (Reader (CurrentFrame address)) sig
|
||||
, Member (Reader (CurrentScope address)) sig
|
||||
, Member (Reader ControlFlowVertex) sig
|
||||
, VertexDeclaration syntax
|
||||
, Declarations1 syntax
|
||||
, Ord address
|
||||
, Ord context
|
||||
, Foldable syntax
|
||||
, hole ~ Hole context (Located address)
|
||||
, term ~ Term syntax Location
|
||||
, Carrier sig m
|
||||
)
|
||||
=> Open (term -> Evaluator term hole value m a)
|
||||
=> Open (term -> Evaluator term address value m a)
|
||||
graphingTerms recur term@(Term (In a syntax)) = do
|
||||
definedInModule <- currentModule
|
||||
case toVertex a definedInModule syntax of
|
||||
|
@ -1,48 +0,0 @@
|
||||
{-# LANGUAGE LambdaCase, TypeOperators, UndecidableInstances #-}
|
||||
module Data.Abstract.Address.Located
|
||||
( Located(..)
|
||||
) where
|
||||
|
||||
import Control.Abstract
|
||||
import Control.Effect.Carrier
|
||||
import Control.Effect.Sum
|
||||
import Data.Abstract.Module (ModuleInfo)
|
||||
import Data.Abstract.Name
|
||||
import Data.Abstract.Package (PackageInfo)
|
||||
|
||||
data Located address = Located
|
||||
{ address :: address
|
||||
, addressPackage :: {-# UNPACK #-} !PackageInfo
|
||||
, addressModule :: !ModuleInfo
|
||||
, addressName :: Name
|
||||
, addressSpan :: Span
|
||||
}
|
||||
deriving (Eq, Ord, Show)
|
||||
|
||||
|
||||
promoteA :: AllocatorC address m a -> AllocatorC (Located address) m a
|
||||
promoteA = AllocatorC . runAllocatorC
|
||||
|
||||
instance ( Carrier (Allocator address :+: sig) (AllocatorC address m)
|
||||
, Carrier sig m
|
||||
, Member (Reader ModuleInfo) sig
|
||||
, Member (Reader PackageInfo) sig
|
||||
, Member (Reader Span) sig
|
||||
, Monad m
|
||||
)
|
||||
=> Carrier (Allocator (Located address) :+: sig) (AllocatorC (Located address) m) where
|
||||
ret = promoteA . ret
|
||||
eff = handleSum
|
||||
(AllocatorC . eff . handleCoercible)
|
||||
(\ (Alloc name k) -> Located <$> promoteA (eff (L (Alloc name ret))) <*> currentPackage <*> currentModule <*> pure name <*> ask >>= k)
|
||||
|
||||
|
||||
promoteD :: DerefC address value m a -> DerefC (Located address) value m a
|
||||
promoteD = DerefC . runDerefC
|
||||
|
||||
instance (Carrier (Deref value :+: sig) (DerefC address value m), Carrier sig m, Monad m)
|
||||
=> Carrier (Deref value :+: sig) (DerefC (Located address) value m) where
|
||||
ret = promoteD . ret
|
||||
eff = handleSum (DerefC . eff . handleCoercible) (\case
|
||||
DerefCell cell k -> promoteD (eff (L (DerefCell cell ret))) >>= k
|
||||
AssignCell value cell k -> promoteD (eff (L (AssignCell value cell ret))) >>= k)
|
@ -34,7 +34,6 @@ import Analysis.Abstract.Graph as Graph
|
||||
import Control.Abstract hiding (String)
|
||||
import Control.Abstract.PythonPackage as PythonPackage
|
||||
import Data.Abstract.Address.Hole as Hole
|
||||
import Data.Abstract.Address.Located as Located
|
||||
import Data.Abstract.Address.Monovariant as Monovariant
|
||||
import Data.Abstract.Address.Precise as Precise
|
||||
import Data.Abstract.BaseError (BaseError (..))
|
||||
@ -114,7 +113,7 @@ runCallGraph :: ( VertexDeclarationWithStrategy (VertexDeclarationStrategy synta
|
||||
runCallGraph lang includePackages modules package
|
||||
= fmap (simplify . fst)
|
||||
. runEvaluator
|
||||
. graphing @_ @_ @_ @(Hole (Maybe Name) (Located Monovariant)) @Abstract
|
||||
. graphing @_ @_ @_ @(Hole (Maybe Name) Monovariant) @Abstract
|
||||
. runHeap
|
||||
. runScopeGraph
|
||||
. caching
|
||||
|
Loading…
Reference in New Issue
Block a user