1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 14:21:31 +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,14 +122,12 @@ runGraph :: ( Member Distribute sig
-> Project -> Project
-> m (Graph ControlFlowVertex) -> m (Graph ControlFlowVertex)
runGraph type' includePackages project runGraph type' includePackages project
| SomeAnalysisParser parser (lang :: Proxy lang) <- someAnalysisParser (Proxy @AnalyzeTerm) (projectLanguage project) = case type' of | SomeAnalysisParser parser (lang :: Proxy lang) <- someAnalysisParser (Proxy @AnalyzeTerm) (projectLanguage project) = do
ImportGraph -> do
let parse = if projectLanguage project == Language.Python then parsePythonPackage parser else fmap (fmap snd) . parsePackage parser let parse = if projectLanguage project == Language.Python then parsePythonPackage parser else fmap (fmap snd) . parsePackage parser
package <- parse project package <- parse project
runImportGraphToModuleInfos lang package case type' of
ImportGraph -> runImportGraphToModuleInfos lang package
CallGraph -> do 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 modules <- topologicalSort <$> runImportGraphToModules lang package
runCallGraph lang includePackages modules package runCallGraph lang includePackages modules package