1
1
mirror of https://github.com/github/semantic.git synced 2024-12-30 02:14:20 +03:00
This commit is contained in:
joshvera 2018-09-14 18:16:54 -04:00
parent a4f84f4371
commit 8e1e9579da
5 changed files with 6 additions and 6 deletions

View File

@ -73,7 +73,7 @@ instance Effect (ScopeEnv address) where
runScopeEnv :: (Ord address, Effects effects, Member Fresh effects, Member (Allocator address) effects)
=> Evaluator address value (ScopeEnv address ': effects) a
-> Evaluator address value effects (ScopeGraph address, a)
runScopeEnv evaluator = runState (ScopeGraph.emptyGraph) (reinterpret handleScopeEnv evaluator)
runScopeEnv evaluator = runState ScopeGraph.emptyGraph (reinterpret handleScopeEnv evaluator)
handleScopeEnv :: forall address value effects a. (Ord address, Member Fresh effects, Member (Allocator address) effects, Effects effects)
=> ScopeEnv address (Eff (ScopeEnv address ': effects)) a

View File

@ -1,4 +1,4 @@
{-# LANGUAGE GADTs, GeneralizedNewtypeDeriving #-}
{-# LANGUAGE GADTs #-}
module Data.Abstract.ScopeGraph
( ScopeGraph(..)
, Path
@ -75,7 +75,7 @@ declare declaration ddata assocScope g@ScopeGraph{..} = fromMaybe g $ do
scopeKey <- currentScope
scope <- lookupScope scopeKey g
let newScope = scope { declarations = Map.insert declaration (ddata, assocScope) (declarations scope) }
pure $ g { graph = (Map.insert scopeKey newScope graph) }
pure $ g { graph = Map.insert scopeKey newScope graph }
reference :: Ord scope => Reference -> Declaration -> ScopeGraph scope -> ScopeGraph scope
reference ref declaration g@ScopeGraph{..} = fromMaybe g $ do

View File

@ -215,7 +215,7 @@ instance Evaluatable Class where
scope <- associatedScope (Declaration name)
(scope,) <$> subtermAddress superclass
let imports = ((I,) <$> (fmap pure . catMaybes $ fst <$> supers))
let imports = (I,) <$> (fmap pure . catMaybes $ fst <$> supers)
current = maybe mempty (fmap (P, ) . pure . pure) currentScope'
edges = Map.fromList (imports <> current)
childScope <- newScope edges

View File

@ -143,7 +143,7 @@ instance Evaluatable Assignment where
case lhs of
LvalLocal name -> do
case (declaredName (subterm assignmentValue)) of
case declaredName (subterm assignmentValue) of
Just rhsName -> do
assocScope <- associatedScope (Declaration rhsName)
let edges = maybe mempty (Map.singleton I . pure) assocScope

View File

@ -366,7 +366,7 @@ instance Show1 ExtendsClause where liftShowsPrec = genericLiftShowsPrec
instance Evaluatable ExtendsClause where
eval ExtendsClause{..} = do
-- Evaluate subterms
_ <- traverse subtermRef extendsClauses
traverse_ subtermRef extendsClauses
rvalBox unit
newtype ArrayType a = ArrayType { arrayType :: a }