mirror of
https://github.com/github/semantic.git
synced 2024-12-25 16:02:43 +03:00
Deref slots in evalRubyProject
Co-Authored-By: Rob Rix <rob.rix@github.com>
This commit is contained in:
parent
1914a94500
commit
73ae9f85a1
@ -109,7 +109,7 @@ evaluateProject' (TaskConfig config logger statter) proxy parser paths = either
|
||||
(runModuleTable
|
||||
(runModules (ModuleTable.modulePaths (packageModules package))
|
||||
(raiseHandler (runReader (packageInfo package))
|
||||
(raiseHandler (runState (lowerBound @Span))
|
||||
(raiseHandler (evalState (lowerBound @Span))
|
||||
(raiseHandler (runReader (lowerBound @Span))
|
||||
(evaluate proxy id (evalTerm withTermSpans) modules)))))))
|
||||
|
||||
@ -122,7 +122,7 @@ evaluatePythonProjects proxy parser lang path = runTaskWithOptions debugOptions
|
||||
(runModuleTable
|
||||
(runModules (ModuleTable.modulePaths (packageModules package))
|
||||
(raiseHandler (runReader (packageInfo package))
|
||||
(raiseHandler (runState (lowerBound @Span))
|
||||
(raiseHandler (evalState (lowerBound @Span))
|
||||
(raiseHandler (runReader (lowerBound @Span))
|
||||
(evaluate proxy id (evalTerm withTermSpans) modules)))))))
|
||||
|
||||
@ -133,7 +133,7 @@ evaluateProjectWithCaching proxy parser path = runTaskWithOptions debugOptions $
|
||||
modules <- topologicalSort <$> runImportGraphToModules proxy package
|
||||
pure (id @(Evaluator _ Monovariant _ _ _)
|
||||
(raiseHandler (runReader (packageInfo package))
|
||||
(raiseHandler (runState (lowerBound @Span))
|
||||
(raiseHandler (evalState (lowerBound @Span))
|
||||
(raiseHandler (runReader (lowerBound @Span))
|
||||
(runModuleTable
|
||||
(runModules (ModuleTable.modulePaths (packageModules package))
|
||||
|
@ -1,15 +1,15 @@
|
||||
{-# LANGUAGE TupleSections #-}
|
||||
module Analysis.Ruby.Spec (spec) where
|
||||
|
||||
import Control.Abstract (Declaration (..), ScopeError (..), runDeref, value)
|
||||
import Control.Effect.Resumable (SomeError (..))
|
||||
import Data.Abstract.Evaluatable
|
||||
import qualified Data.Abstract.ModuleTable as ModuleTable
|
||||
import Data.Abstract.Number as Number
|
||||
import Data.Abstract.Value.Concrete as Value
|
||||
import Control.Effect.Resumable (SomeError(..))
|
||||
import qualified Data.Language as Language
|
||||
import Data.List.NonEmpty (NonEmpty (..))
|
||||
import Data.Sum
|
||||
import qualified Data.Language as Language
|
||||
import Data.Abstract.Evaluatable
|
||||
import Control.Abstract (ScopeError(..), Declaration(..), value)
|
||||
|
||||
import SpecHelpers
|
||||
|
||||
@ -100,4 +100,11 @@ spec config = parallel $ do
|
||||
where
|
||||
fixtures = "test/fixtures/ruby/analysis/"
|
||||
evaluate = evalRubyProject . map (fixtures <>)
|
||||
evalRubyProject = testEvaluating <=< evaluateProject' config (Proxy :: Proxy 'Language.Ruby) rubyParser
|
||||
evalRubyProject files = testEvaluating =<< do
|
||||
action <- evaluateProject' config (Proxy :: Proxy 'Language.Ruby) rubyParser files
|
||||
pure $ do
|
||||
moduleTable <- action
|
||||
for moduleTable (traverse (\ (Module info (scopeAndFrame, valueRef)) -> do
|
||||
|
||||
valueRef' <- raiseHandler (runReader info . runReader emptySpan) (runDeref (value valueRef >>= rvalBox))
|
||||
pure (Module info (scopeAndFrame, valueRef'))))
|
||||
|
@ -26,6 +26,7 @@ import qualified Data.Abstract.Heap as Heap
|
||||
import Control.Arrow ((&&&))
|
||||
import Control.Effect.Trace as X (runTraceByIgnoring, runTraceByReturning)
|
||||
import Control.Monad ((>=>))
|
||||
import Data.Traversable as X (for)
|
||||
import Data.Abstract.Address.Precise as X
|
||||
import Data.Abstract.Evaluatable hiding (lookupDeclaration)
|
||||
import Data.Abstract.FreeVariables as X
|
||||
@ -136,7 +137,7 @@ type TestEvaluatingErrors term
|
||||
, BaseError (UnspecializedError (Val term))
|
||||
, BaseError (LoadError Precise (Val term))
|
||||
]
|
||||
testEvaluating :: Evaluator term Precise (Val term) (TestEvaluatingC term) (Span, a)
|
||||
testEvaluating :: Evaluator term Precise (Val term) (TestEvaluatingC term) a
|
||||
-> IO
|
||||
(ScopeGraph Precise,
|
||||
(Heap Precise Precise (Value term Precise),
|
||||
@ -157,7 +158,6 @@ testEvaluating
|
||||
. runResolutionError
|
||||
. runValueError
|
||||
. runAddressError
|
||||
. fmap snd
|
||||
|
||||
type Val term = Value term Precise
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user