diff --git a/src/Analysis/Abstract/Caching.hs b/src/Analysis/Abstract/Caching.hs index 9e96affb8..97133344e 100644 --- a/src/Analysis/Abstract/Caching.hs +++ b/src/Analysis/Abstract/Caching.hs @@ -36,8 +36,8 @@ lookupCache configuration = cacheLookup configuration <$> get cachingConfiguration :: (Cacheable term address (Cell address) value, Member (State (Cache term address (Cell address) value)) effects, Member (State (Heap address (Cell address) value)) effects) => Configuration term address (Cell address) value -> Set (Cached address (Cell address) value) - -> TermEvaluator term address value effects (ValueRef address value) - -> TermEvaluator term address value effects (ValueRef address value) + -> TermEvaluator term address value effects (ValueRef address) + -> TermEvaluator term address value effects (ValueRef address) cachingConfiguration configuration values action = do modify' (cacheSet configuration values) result <- Cached <$> action <*> TermEvaluator getHeap @@ -65,8 +65,8 @@ cachingTerms :: ( Cacheable term address (Cell address) value , Member (Env address) effects , Member (State (Heap address (Cell address) value)) effects ) - => SubtermAlgebra (Base term) term (TermEvaluator term address value effects (ValueRef address value)) - -> SubtermAlgebra (Base term) term (TermEvaluator term address value effects (ValueRef address value)) + => SubtermAlgebra (Base term) term (TermEvaluator term address value effects (ValueRef address)) + -> SubtermAlgebra (Base term) term (TermEvaluator term address value effects (ValueRef address)) cachingTerms recur term = do c <- getConfiguration (embedSubterm term) cached <- lookupCache c @@ -122,7 +122,7 @@ converge seed f = loop seed loop x' -- | Nondeterministically write each of a collection of stores & return their associated results. -scatter :: (Foldable t, Member NonDet effects, Member (State (Heap address (Cell address) value)) effects) => t (Cached address (Cell address) value) -> TermEvaluator term address value effects (ValueRef address value) +scatter :: (Foldable t, Member NonDet effects, Member (State (Heap address (Cell address) value)) effects) => t (Cached address (Cell address) value) -> TermEvaluator term address value effects (ValueRef address) scatter = foldMapA (\ (Cached value heap') -> TermEvaluator (putHeap heap') $> value) diff --git a/src/Control/Abstract/Value.hs b/src/Control/Abstract/Value.hs index 3d710ef6b..8998ffde2 100644 --- a/src/Control/Abstract/Value.hs +++ b/src/Control/Abstract/Value.hs @@ -219,7 +219,7 @@ value :: ( AbstractValue address value effects , Member (Env address) effects , Member (Resumable (EnvironmentError address)) effects ) - => ValueRef address value + => ValueRef address -> Evaluator address value effects value value = deref <=< address @@ -229,7 +229,7 @@ subtermValue :: ( AbstractValue address value effects , Member (Env address) effects , Member (Resumable (EnvironmentError address)) effects ) - => Subterm term (Evaluator address value effects (ValueRef address value)) + => Subterm term (Evaluator address value effects (ValueRef address)) -> Evaluator address value effects value subtermValue = value <=< subtermRef @@ -239,7 +239,7 @@ address :: ( AbstractValue address value effects , Member (Env address) effects , Member (Resumable (EnvironmentError address)) effects ) - => ValueRef address value + => ValueRef address -> Evaluator address value effects address address (LvalLocal var) = variable var address (LvalMember obj prop) = evaluateInScopedEnv (deref obj) (variable prop) @@ -251,12 +251,12 @@ subtermAddress :: ( AbstractValue address value effects , Member (Env address) effects , Member (Resumable (EnvironmentError address)) effects ) - => Subterm term (Evaluator address value effects (ValueRef address value)) + => Subterm term (Evaluator address value effects (ValueRef address)) -> Evaluator address value effects address subtermAddress = address <=< subtermRef -- | Convenience function for boxing a raw value and wrapping it in an Rval rvalBox :: Member (Allocator address value) effects => value - -> Evaluator address value effects (ValueRef address value) + -> Evaluator address value effects (ValueRef address) rvalBox val = Rval <$> box val diff --git a/src/Data/Abstract/Cache.hs b/src/Data/Abstract/Cache.hs index 59829a15c..0112f7cd9 100644 --- a/src/Data/Abstract/Cache.hs +++ b/src/Data/Abstract/Cache.hs @@ -13,7 +13,7 @@ newtype Cache term address cell value = Cache { unCache :: Monoidal.Map (Configu deriving (Eq, Lower, Monoid, Ord, Reducer (Configuration term address cell value, Cached address cell value), Semigroup) data Cached address cell value = Cached - { cachedValue :: ValueRef address value + { cachedValue :: ValueRef address , cachedHeap :: Heap address cell value } deriving (Eq, Ord, Show) diff --git a/src/Data/Abstract/Evaluatable.hs b/src/Data/Abstract/Evaluatable.hs index 62cb90d08..4122432e1 100644 --- a/src/Data/Abstract/Evaluatable.hs +++ b/src/Data/Abstract/Evaluatable.hs @@ -58,7 +58,7 @@ class Show1 constr => Evaluatable constr where , Member (Return address value) effects , Member Trace effects ) - => SubtermAlgebra constr term (Evaluator address value effects (ValueRef address value)) + => SubtermAlgebra constr term (Evaluator address value effects (ValueRef address)) eval expr = rvalBox =<< throwResumable (Unspecialized ("Eval unspecialized for " ++ liftShowsPrec (const (const id)) (const id) 0 expr "")) @@ -89,7 +89,7 @@ evaluatePackageWith :: forall address term value inner inner' inner'' outer , inner'' ~ (Modules address value ': Reader Span ': Reader PackageInfo ': outer) ) => (SubtermAlgebra Module term (TermEvaluator term address value inner address) -> SubtermAlgebra Module term (TermEvaluator term address value inner address)) - -> (SubtermAlgebra (Base term) term (TermEvaluator term address value inner (ValueRef address value)) -> SubtermAlgebra (Base term) term (TermEvaluator term address value inner (ValueRef address value))) + -> (SubtermAlgebra (Base term) term (TermEvaluator term address value inner (ValueRef address)) -> SubtermAlgebra (Base term) term (TermEvaluator term address value inner (ValueRef address))) -> Package term -> TermEvaluator term address value outer [(address, Environment address)] evaluatePackageWith analyzeModule analyzeTerm package diff --git a/src/Data/Abstract/Ref.hs b/src/Data/Abstract/Ref.hs index 6f45ebbd7..96e38ae79 100644 --- a/src/Data/Abstract/Ref.hs +++ b/src/Data/Abstract/Ref.hs @@ -4,13 +4,13 @@ module Data.Abstract.Ref where import Data.Abstract.Name -- | 'ValueRef' is the type subterms evaluate to and can represent either values directly ('Rval'), or references to values (lvals - such as local variables or object members) -data ValueRef address value where +data ValueRef address where -- | A value. - Rval :: address -> ValueRef address value + Rval :: address -> ValueRef address -- | A local variable. No environment is attached—it’s assumed that 'LvalLocal' will be evaluated in the same scope it was constructed in. - LvalLocal :: Name -> ValueRef address value + LvalLocal :: Name -> ValueRef address -- | An object member. - LvalMember :: address -> Name -> ValueRef address value + LvalMember :: address -> Name -> ValueRef address deriving (Eq, Ord, Show) diff --git a/src/Language/PHP/Syntax.hs b/src/Language/PHP/Syntax.hs index eecacfe03..e5b29aa00 100644 --- a/src/Language/PHP/Syntax.hs +++ b/src/Language/PHP/Syntax.hs @@ -54,9 +54,9 @@ include :: ( AbstractValue address value effects , Member (Resumable (EnvironmentError address)) effects , Member Trace effects ) - => Subterm term (Evaluator address value effects (ValueRef address value)) + => Subterm term (Evaluator address value effects (ValueRef address)) -> (ModulePath -> Evaluator address value effects (Maybe (address, Environment address))) - -> Evaluator address value effects (ValueRef address value) + -> Evaluator address value effects (ValueRef address) include pathTerm f = do name <- subtermValue pathTerm >>= asString path <- resolvePHPName name