1
1
mirror of https://github.com/anoma/juvix.git synced 2024-12-15 18:13:56 +03:00
juvix/app/Commands/Dev/Termination/Calls.hs

21 lines
932 B
Haskell
Raw Normal View History

2022-09-14 17:16:15 +03:00
module Commands.Dev.Termination.Calls where
import Commands.Base
import Commands.Dev.Termination.Calls.Options
import Juvix.Compiler.Abstract.Pretty qualified as Abstract
import Juvix.Compiler.Abstract.Translation.FromConcrete qualified as Abstract
import Juvix.Compiler.Internal.Translation.FromAbstract.Analysis.Termination qualified as Termination
runCommand :: (Members '[Embed IO, App] r) => CallsOptions -> Sem r ()
2022-09-14 17:16:15 +03:00
runCommand localOpts@CallsOptions {..} = do
globalOpts <- askGlobalOptions
results <- runPipeline _callsInputFile upToAbstract
let topModule = head (results ^. Abstract.resultModules)
infotable = results ^. Abstract.resultTable
callMap0 = Termination.buildCallMap infotable topModule
callMap = case _callsFunctionNameFilter of
Nothing -> callMap0
Just f -> Termination.filterCallMap f callMap0
renderStdOut (Abstract.ppOut (globalOpts, localOpts) callMap)
newline