mirror of
https://github.com/github/semantic.git
synced 2024-12-03 00:16:52 +03:00
Insert vertices rather than names.
This commit is contained in:
parent
1d375d8d61
commit
92b4cb9168
@ -60,7 +60,7 @@ instance ( Effectful m
|
||||
analyzeTerm eval term@(In _ syntax) = do
|
||||
case prj syntax of
|
||||
Just (Syntax.Identifier name) -> do
|
||||
insertVertexName name
|
||||
insertVertex (Variable name)
|
||||
o <- lookupEnv name
|
||||
case o >>= withSomeOrigin originModule . origin . unAddress of
|
||||
Just ModuleInfo{..} -> modifyImportGraph (vertex (Variable name) >< vertex (Module moduleName) <>)
|
||||
@ -70,13 +70,13 @@ instance ( Effectful m
|
||||
resumeException
|
||||
@(LoadError term value)
|
||||
(liftAnalyze analyzeTerm eval term)
|
||||
(\yield (LoadError name) -> insertVertexName name >> yield [])
|
||||
(\yield (LoadError name) -> insertVertex (Module name) >> yield [])
|
||||
|
||||
analyzeModule recur m = do
|
||||
let name = moduleName (moduleInfo m)
|
||||
o <- raise ask
|
||||
modifyImportGraph (packageGraph @term o >< vertex (Module name) <>)
|
||||
insertVertexName name
|
||||
insertVertex (Module name)
|
||||
liftAnalyze analyzeModule recur m
|
||||
|
||||
parentGraph :: SomeOrigin term -> ImportGraph
|
||||
@ -88,17 +88,17 @@ packageGraph = maybe empty (vertex . Package . packageName) . withSomeOrigin ori
|
||||
moduleGraph :: SomeOrigin term -> ImportGraph
|
||||
moduleGraph = maybe empty (vertex . Module . moduleName) . withSomeOrigin originModule
|
||||
|
||||
insertVertexName :: forall m location term value effects
|
||||
. ( Effectful m
|
||||
, Member (Reader (SomeOrigin term)) effects
|
||||
, Member (State ImportGraph) effects
|
||||
, MonadEvaluator location term value (m effects)
|
||||
)
|
||||
=> NonEmpty ByteString
|
||||
-> ImportGraphing m effects ()
|
||||
insertVertexName name = do
|
||||
insertVertex :: forall m location term value effects
|
||||
. ( Effectful m
|
||||
, Member (Reader (SomeOrigin term)) effects
|
||||
, Member (State ImportGraph) effects
|
||||
, MonadEvaluator location term value (m effects)
|
||||
)
|
||||
=> Vertex
|
||||
-> ImportGraphing m effects ()
|
||||
insertVertex v = do
|
||||
o <- raise ask
|
||||
modifyImportGraph (parentGraph @term o >< vertex (Module name) <>)
|
||||
modifyImportGraph (parentGraph @term o >< vertex v <>)
|
||||
|
||||
(><) :: Graph a => a -> a -> a
|
||||
(><) = connect
|
||||
|
Loading…
Reference in New Issue
Block a user