1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 13:21:59 +03:00

Move resumingBadVariables into Semantic.Graph.

This commit is contained in:
Rob Rix 2018-05-06 17:03:26 -04:00
parent bf42793078
commit 3a79bc0dc3
2 changed files with 15 additions and 4 deletions

View File

@ -4,7 +4,6 @@ module Semantic.Graph where
import Analysis.Abstract.BadAddresses
import Analysis.Abstract.BadSyntax
import Analysis.Abstract.BadValues
import Analysis.Abstract.BadVariables
import Analysis.Abstract.Evaluating
import Analysis.Abstract.ImportGraph
import qualified Control.Exception as Exc
@ -90,7 +89,7 @@ importGraphAnalysis
. runLoadError
. resumingBadSyntax
. resumingBadValues
. resumingBadVariables
. resumingEvalError
. resumingResolutionError
. resumingBadAddresses
. importGraphing
@ -100,6 +99,19 @@ resumingResolutionError = runResolutionErrorWith (\ err -> traceM ("ResolutionEr
NotFoundError nameToResolve _ _ -> pure nameToResolve
GoImportError pathToResolve -> pure [pathToResolve])
resumingEvalError :: (AbstractHole value, Show value) => Evaluator location term value (Resumable (EvalError value) ': State [Name] ': effects) a -> Evaluator location term value effects (a, [Name])
resumingEvalError
= runState []
. runEvalErrorWith (\ err -> traceM ("EvalError" <> show err) *> case err of
EnvironmentLookupError{} -> pure hole
DefaultExportError{} -> pure ()
ExportError{} -> pure ()
IntegerFormatError{} -> pure 0
FloatFormatError{} -> pure 0
RationalFormatError{} -> pure 0
FreeVariableError name -> raise (modify' (name :)) *> pure hole
FreeVariablesError names -> raise (modify' (names <>)) *> pure (fromMaybeLast "unknown" names))
-- | Render the import graph for a given 'Package'.
graphImports :: ( Show ann
, Apply Declarations1 syntax

View File

@ -5,7 +5,6 @@ module Semantic.Util where
import Analysis.Abstract.BadAddresses
import Analysis.Abstract.BadSyntax
import Analysis.Abstract.BadValues
import Analysis.Abstract.BadVariables
import Analysis.Abstract.Caching
import Analysis.Abstract.Collecting
import Analysis.Abstract.Evaluating as X
@ -44,7 +43,7 @@ evaluatingWithHoles
. runLoadError
. resumingBadSyntax @(Value Precise)
. resumingBadValues @(Value Precise)
. resumingBadVariables @(Value Precise)
. resumingEvalError
. resumingResolutionError
. resumingBadAddresses @(Value Precise)