mirror of
https://github.com/github/semantic.git
synced 2024-12-23 14:54:16 +03:00
Evaluate Ruby files using the helper.
This commit is contained in:
parent
5887ba194f
commit
e912723b92
@ -37,13 +37,11 @@ file :: MonadIO m => FilePath -> m Blob
|
|||||||
file path = fromJust <$> IO.readFile path (languageForFilePath path)
|
file path = fromJust <$> IO.readFile path (languageForFilePath path)
|
||||||
|
|
||||||
-- Ruby
|
-- Ruby
|
||||||
evaluateRubyFile path = Prelude.fst . evaluate @RubyValue <$>
|
evaluateRubyFile path = Prelude.fst . evaluate @RubyValue . snd <$> parseFile rubyParser path
|
||||||
(file path >>= runTask . parse rubyParser)
|
|
||||||
|
|
||||||
evaluateRubyFiles paths = do
|
evaluateRubyFiles paths = do
|
||||||
blobs@(b:bs) <- traverse file paths
|
first:rest <- traverse (parseFile rubyParser) paths
|
||||||
(t:ts) <- runTask $ traverse (parse rubyParser) blobs
|
pure $ evaluates @RubyValue rest first
|
||||||
pure $ evaluates @RubyValue (zip bs ts) (b, t)
|
|
||||||
|
|
||||||
-- Python
|
-- Python
|
||||||
typecheckPythonFile path = run @(CachingAnalysis (Evaluating Python.Term Type (CachingEffects Python.Term Type (EvaluatingEffects Python.Term Type)))) . evaluateModule <$> (file path >>= runTask . parse pythonParser)
|
typecheckPythonFile path = run @(CachingAnalysis (Evaluating Python.Term Type (CachingEffects Python.Term Type (EvaluatingEffects Python.Term Type)))) . evaluateModule <$> (file path >>= runTask . parse pythonParser)
|
||||||
@ -57,8 +55,8 @@ evaluateDeadTracePythonFile path = run @(DeadCodeAnalysis PythonTracer) . evalua
|
|||||||
evaluatePythonFile path = evaluate @PythonValue . snd <$> parseFile pythonParser path
|
evaluatePythonFile path = evaluate @PythonValue . snd <$> parseFile pythonParser path
|
||||||
|
|
||||||
evaluatePythonFiles paths = do
|
evaluatePythonFiles paths = do
|
||||||
pair:pairs <- traverse (parseFile pythonParser) paths
|
first:rest <- traverse (parseFile pythonParser) paths
|
||||||
pure $ evaluates @PythonValue pairs pair
|
pure $ evaluates @PythonValue rest first
|
||||||
|
|
||||||
parseFile parser path = runTask (file path >>= fmap . (,) <*> parse parser)
|
parseFile parser path = runTask (file path >>= fmap . (,) <*> parse parser)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user