1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

Facror the common part of runGraph out.

This commit is contained in:
Rob Rix 2019-10-18 15:00:41 -04:00
parent 3b2bda990f
commit 3dcc0de5b2
No known key found for this signature in database
GPG Key ID: F188A01508EA1CF7

View File

@ -122,16 +122,14 @@ runGraph :: ( Member Distribute sig
-> Project
-> m (Graph ControlFlowVertex)
runGraph type' includePackages project
| SomeAnalysisParser parser (lang :: Proxy lang) <- someAnalysisParser (Proxy @AnalyzeTerm) (projectLanguage project) = case type' of
ImportGraph -> do
| SomeAnalysisParser parser (lang :: Proxy lang) <- someAnalysisParser (Proxy @AnalyzeTerm) (projectLanguage project) = do
let parse = if projectLanguage project == Language.Python then parsePythonPackage parser else fmap (fmap snd) . parsePackage parser
package <- parse project
runImportGraphToModuleInfos lang package
CallGraph -> do
let parse = if projectLanguage project == Language.Python then parsePythonPackage parser else fmap (fmap snd) . parsePackage parser
package <- parse project
modules <- topologicalSort <$> runImportGraphToModules lang package
runCallGraph lang includePackages modules package
case type' of
ImportGraph -> runImportGraphToModuleInfos lang package
CallGraph -> do
modules <- topologicalSort <$> runImportGraphToModules lang package
runCallGraph lang includePackages modules package
runCallGraph :: ( AnalyzeTerm term
, HasPrelude lang