mirror of
https://github.com/github/semantic.git
synced 2024-12-20 21:31:48 +03:00
Catch LoadErrors in ImportGraph analysis and inject them into the Import Graph
This commit is contained in:
parent
9ca6b66665
commit
4eaffa9f49
@ -11,6 +11,7 @@ import Algebra.Graph.Export.Dot
|
||||
import Control.Abstract.Analysis
|
||||
import Data.Abstract.FreeVariables
|
||||
import Data.Abstract.Module
|
||||
import Data.Abstract.Evaluatable (EvalError(..))
|
||||
import Prologue hiding (empty)
|
||||
|
||||
-- | The graph of function definitions to symbols used in a given program.
|
||||
@ -34,11 +35,18 @@ deriving instance MonadEvaluator term value (m term value effects) => MonadEvalu
|
||||
instance ( Effectful (m term value)
|
||||
, Member (State ImportGraph) effects
|
||||
, MonadAnalysis term value (m term value effects)
|
||||
, Member (Resumable (EvalError term value)) effects
|
||||
)
|
||||
=> MonadAnalysis term value (ImportGraphing m term value effects) where
|
||||
type RequiredEffects term value (ImportGraphing m term value effects) = State ImportGraph ': RequiredEffects term value (m term value effects)
|
||||
|
||||
analyzeTerm = liftAnalyze analyzeTerm
|
||||
analyzeTerm eval term = resumeException @(EvalError term value) (liftAnalyze analyzeTerm eval term) (\yield (LoadError name) ->
|
||||
do
|
||||
ms <- askModuleStack
|
||||
let parent = maybe empty (vertex . moduleName) (listToMaybe ms)
|
||||
modifyImportGraph (parent >< vertex name <>)
|
||||
yield []
|
||||
)
|
||||
|
||||
analyzeModule recur m = do
|
||||
ms <- askModuleStack
|
||||
|
Loading…
Reference in New Issue
Block a user