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 +4
-2
lines changed
semantic-core/src/Analysis Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -103,11 +103,11 @@ scopeGraphAnalysis = Analysis{..}
103103 ref <- asks Ref
104104 bindLoc <- asks (Map. lookup addr)
105105 cell <- gets (Map. lookup addr >=> nonEmpty . Set. toList)
106- maybe (pure Nothing ) (foldMapA (pure . Just . mappend (ScopeGraph ( maybe Map. empty ( \ bindLoc -> Map. singleton ( Decl addr bindLoc) ( Set. singleton ref)) bindLoc) ))) cell
106+ maybe (pure Nothing ) (foldMapA (pure . Just . mappend (extendBinding addr ref bindLoc))) cell
107107 assign addr v = do
108108 ref <- asks Ref
109109 bindLoc <- asks (Map. lookup addr)
110- modify (Map. insertWith (<>) addr (Set. singleton (ScopeGraph ( maybe Map. empty ( \ bindLoc -> Map. singleton ( Decl addr bindLoc) ( Set. singleton ref)) bindLoc) <> v)))
110+ modify (Map. insertWith (<>) addr (Set. singleton (extendBinding addr ref bindLoc <> v)))
111111 abstract eval name body = do
112112 addr <- alloc name
113113 assign name (mempty @ ScopeGraph )
@@ -126,3 +126,5 @@ scopeGraphAnalysis = Analysis{..}
126126 (k, v') <$ assign addr v'
127127 pure (foldMap snd fields')
128128 _ ... m = pure (Just m)
129+
130+ extendBinding addr ref bindLoc = ScopeGraph (maybe Map. empty (\ bindLoc -> Map. singleton (Decl addr bindLoc) (Set. singleton ref)) bindLoc)
You can’t perform that action at this time.
0 commit comments