1
1
mirror of https://github.com/github/semantic.git synced 2024-12-20 05:11:44 +03:00

Add justEvaluatingCatchingErrors so we fly through exceptions

This commit is contained in:
joshvera 2019-01-22 18:19:06 -05:00
parent 245e021750
commit 3e599d2ca0
2 changed files with 21 additions and 3 deletions

View File

@ -21,7 +21,8 @@ module Semantic.Graph
, resumingUnspecialized , resumingUnspecialized
, resumingAddressError , resumingAddressError
, resumingValueError , resumingValueError
-- , resumingEnvironmentError -- TODO: Fix me. Replace with resumingScopeGraphError? , resumingHeapError
, resumingScopeError
, resumingTypeError , resumingTypeError
) where ) where

View File

@ -13,6 +13,7 @@ import Control.Exception (displayException)
import Control.Effect.Trace (runTraceByPrinting) import Control.Effect.Trace (runTraceByPrinting)
import Data.Abstract.Address.Monovariant as Monovariant import Data.Abstract.Address.Monovariant as Monovariant
import Data.Abstract.Address.Precise as Precise import Data.Abstract.Address.Precise as Precise
import Data.Abstract.Address.Hole as Hole
import Data.Abstract.Evaluatable import Data.Abstract.Evaluatable
import Data.Abstract.Module import Data.Abstract.Module
import qualified Data.Abstract.ModuleTable as ModuleTable import qualified Data.Abstract.ModuleTable as ModuleTable
@ -54,6 +55,22 @@ justEvaluating
. runAddressError . runAddressError
. runValueError . runValueError
justEvaluatingCatchingErrors
= runM
. runEvaluator @_ @_ @(Value _ (Hole.Hole (Maybe Name) Precise))
. raiseHandler runTraceByPrinting
. runHeap
. runScopeGraph
. raiseHandler runFresh
. resumingLoadError
. resumingUnspecialized
. resumingScopeError
. resumingHeapError
. resumingEvalError
. resumingResolutionError
. resumingAddressError
. resumingValueError
checking checking
= runM = runM
. runEvaluator . runEvaluator
@ -90,7 +107,7 @@ callGraphProject parser proxy opts paths = runTaskWithOptions opts $ do
x <- runCallGraph proxy False modules package x <- runCallGraph proxy False modules package
pure (x, (() <$) <$> modules) pure (x, (() <$) <$> modules)
evaluatePythonProject = justEvaluating <=< evaluatePythonProjects (Proxy @'Language.Python) pythonParser Language.Python evaluatePythonProject = justEvaluatingCatchingErrors <=< evaluatePythonProjects (Proxy @'Language.Python) pythonParser Language.Python
callGraphRubyProject = callGraphProject rubyParser (Proxy @'Language.Ruby) debugOptions callGraphRubyProject = callGraphProject rubyParser (Proxy @'Language.Ruby) debugOptions
@ -118,7 +135,7 @@ evaluatePythonProjects proxy parser lang path = runTaskWithOptions debugOptions
package <- fmap quieterm <$> parsePythonPackage parser project package <- fmap quieterm <$> parsePythonPackage parser project
modules <- topologicalSort <$> runImportGraphToModules proxy package modules <- topologicalSort <$> runImportGraphToModules proxy package
trace $ "evaluating with load order: " <> show (map (modulePath . moduleInfo) modules) trace $ "evaluating with load order: " <> show (map (modulePath . moduleInfo) modules)
pure (id @(Evaluator _ Precise (Value _ Precise) _ _) pure (id @(Evaluator _ (Hole.Hole (Maybe Name) Precise) (Value _ (Hole.Hole (Maybe Name) Precise)) _ _)
(runModuleTable (runModuleTable
(runModules (ModuleTable.modulePaths (packageModules package)) (runModules (ModuleTable.modulePaths (packageModules package))
(raiseHandler (runReader (packageInfo package)) (raiseHandler (runReader (packageInfo package))