1
1
mirror of https://github.com/github/semantic.git synced 2024-12-23 14:54:16 +03:00

Define a convenience for evaluating Python with dead code and tracing analyses.

This commit is contained in:
Rob Rix 2018-03-08 10:50:55 -05:00
parent 902f269847
commit 9fa05c9b61

View File

@ -4,6 +4,7 @@ module Semantic.Util where
import Prologue
import Analysis.Abstract.Caching
import Analysis.Abstract.Dead
import Analysis.Abstract.Evaluating
import Analysis.Abstract.Tracing
import Analysis.Declaration
@ -49,6 +50,10 @@ typecheckPythonFile path = run . lower @(CachingAnalysis (Evaluating Python.Term
tracePythonFile path = run . lower @(TracingAnalysis [] (Evaluating Python.Term PythonValue (TracingEffects [] Python.Term PythonValue))) . evaluateTerm <$> (file path >>= runTask . parse pythonParser)
type PythonTracer = TracingAnalysis [] (Evaluating Python.Term PythonValue (State (Dead (Python.Term)) ': TracingEffects [] Python.Term PythonValue))
evaluateDeadTracePythonFile path = run . lower @(DeadCodeAnalysis PythonTracer) . evaluateDead <$> (file path >>= runTask . parse pythonParser)
evaluatePythonFile path = evaluate @PythonValue <$>
(file path >>= runTask . parse pythonParser)