mirror of
https://github.com/github/semantic.git
synced 2024-11-28 01:47:01 +03:00
Move evaluateInScopedEnv into Control.Abstract.Value.
This commit is contained in:
parent
f33df9946d
commit
625dfb6fea
@ -7,6 +7,7 @@ module Control.Abstract.Value
|
||||
, doWhile
|
||||
, forLoop
|
||||
, makeNamespace
|
||||
, evaluateInScopedEnv
|
||||
, ValueRoots(..)
|
||||
) where
|
||||
|
||||
@ -198,6 +199,18 @@ makeNamespace name addr super = do
|
||||
v <$ assign addr v
|
||||
|
||||
|
||||
-- | Evaluate a term within the context of the scoped environment of 'scopedEnvTerm'.
|
||||
evaluateInScopedEnv :: ( AbstractValue location value effects
|
||||
, Member (State (Environment location value)) effects
|
||||
)
|
||||
=> Evaluator location value effects value
|
||||
-> Evaluator location value effects value
|
||||
-> Evaluator location value effects value
|
||||
evaluateInScopedEnv scopedEnvTerm term = do
|
||||
scopedEnv <- scopedEnvTerm >>= scopedEnvironment
|
||||
maybe term (flip localEnv term . mergeEnvs) scopedEnv
|
||||
|
||||
|
||||
-- | Value types, e.g. closures, which can root a set of addresses.
|
||||
class ValueRoots location value where
|
||||
-- | Compute the set of addresses rooted by a given value.
|
||||
|
@ -10,7 +10,6 @@ module Data.Abstract.Evaluatable
|
||||
, runEvalErrorWith
|
||||
, value
|
||||
, subtermValue
|
||||
, evaluateInScopedEnv
|
||||
, evaluatePackageWith
|
||||
, throwEvalError
|
||||
, traceResolve
|
||||
@ -93,17 +92,6 @@ runEvalError = runResumable
|
||||
runEvalErrorWith :: Effectful (m value) => (forall resume . EvalError value resume -> m value effects resume) -> m value (Resumable (EvalError value) ': effects) a -> m value effects a
|
||||
runEvalErrorWith = runResumableWith
|
||||
|
||||
-- | Evaluate a term within the context of the scoped environment of 'scopedEnvTerm'.
|
||||
evaluateInScopedEnv :: ( AbstractValue location value effects
|
||||
, Member (State (Environment location value)) effects
|
||||
)
|
||||
=> Evaluator location value effects value
|
||||
-> Evaluator location value effects value
|
||||
-> Evaluator location value effects value
|
||||
evaluateInScopedEnv scopedEnvTerm term = do
|
||||
scopedEnv <- scopedEnvTerm >>= scopedEnvironment
|
||||
maybe term (flip localEnv term . mergeEnvs) scopedEnv
|
||||
|
||||
deriving instance Eq a => Eq (EvalError a b)
|
||||
deriving instance Show a => Show (EvalError a b)
|
||||
instance Show value => Show1 (EvalError value) where
|
||||
|
Loading…
Reference in New Issue
Block a user