This repository was archived by the owner on Apr 1, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
semantic-core/src/Analysis Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -33,7 +33,10 @@ data Entry = Entry
3333 }
3434 deriving (Eq , Ord , Show )
3535
36- newtype ScopeGraph = ScopeGraph { unScopeGraph :: Map. Map Entry (Set. Set Entry ) }
36+ newtype Ref = Ref Loc
37+ deriving (Eq , Ord , Show )
38+
39+ newtype ScopeGraph = ScopeGraph { unScopeGraph :: Map. Map Entry (Set. Set Ref ) }
3740 deriving (Eq , Ord , Show )
3841
3942instance Semigroup ScopeGraph where
@@ -96,10 +99,10 @@ scopeGraphAnalysis = Analysis{..}
9699 local (Map. insert name loc) m
97100 lookupEnv = pure . Just
98101 deref addr = do
99- loc <- ask @ Loc
102+ ref <- asks Ref
100103 bindLoc <- asks (Map. lookup addr)
101104 cell <- gets (Map. lookup addr >=> nonEmpty . Set. toList)
102- maybe (pure Nothing ) (foldMapA (pure . Just . mappend (ScopeGraph (maybe Map. empty (\ bindLoc -> Map. singleton (Entry addr bindLoc) (Set. singleton ( Entry addr loc) )) bindLoc)))) cell
105+ maybe (pure Nothing ) (foldMapA (pure . Just . mappend (ScopeGraph (maybe Map. empty (\ bindLoc -> Map. singleton (Entry addr bindLoc) (Set. singleton ref )) bindLoc)))) cell
103106 assign addr v = modify (Map. insertWith (<>) addr (Set. singleton v))
104107 abstract eval name body = do
105108 addr <- alloc name
You can’t perform that action at this time.
0 commit comments