mirror of
https://github.com/github/semantic.git
synced 2024-11-28 01:47:01 +03:00
Construct scope graphs on deref.
This commit is contained in:
parent
6cb9af299e
commit
a4066b9df6
@ -95,7 +95,11 @@ scopeGraphAnalysis = Analysis{..}
|
||||
loc <- ask @Loc
|
||||
local (Map.insert name loc) m
|
||||
lookupEnv = pure . Just
|
||||
deref addr = gets (Map.lookup addr >=> nonEmpty . Set.toList) >>= maybe (pure Nothing) (foldMapA (pure . Just))
|
||||
deref addr = do
|
||||
loc <- ask @Loc
|
||||
bindLoc <- asks (Map.lookup addr)
|
||||
cell <- gets (Map.lookup addr >=> nonEmpty . Set.toList)
|
||||
maybe (pure Nothing) (foldMapA (pure . Just . mappend (ScopeGraph (maybe Map.empty (\ bindLoc -> Map.singleton (Entry addr bindLoc) (Set.singleton (Entry addr loc))) bindLoc)))) cell
|
||||
assign addr v = modify (Map.insertWith (<>) addr (Set.singleton v))
|
||||
abstract eval name body = do
|
||||
addr <- alloc name
|
||||
|
Loading…
Reference in New Issue
Block a user