From 8ca8ba2e036190b20c31373aadf4d695664613d1 Mon Sep 17 00:00:00 2001 From: Michael Peyton Jones Date: Wed, 13 Oct 2021 16:44:10 +0100 Subject: [PATCH] Add a specific option to dump UPLC so you can directly get the final output only --- plutus-tx-plugin/src/PlutusTx/Plugin.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plutus-tx-plugin/src/PlutusTx/Plugin.hs b/plutus-tx-plugin/src/PlutusTx/Plugin.hs index 835f68e7d2b..45930c122c7 100644 --- a/plutus-tx-plugin/src/PlutusTx/Plugin.hs +++ b/plutus-tx-plugin/src/PlutusTx/Plugin.hs @@ -62,6 +62,7 @@ data PluginOptions = PluginOptions { , poContextLevel :: Int , poDumpPir :: Bool , poDumpPlc :: Bool + , poDumpUPlc :: Bool , poOptimize :: Bool , poPedantic :: Bool , poVerbose :: Bool @@ -139,6 +140,7 @@ parsePluginArgs args = do , poContextLevel = if elem' "no-context" then 0 else if elem "debug-context" args then 3 else 1 , poDumpPir = elem' "dump-pir" , poDumpPlc = elem' "dump-plc" + , poDumpUPlc = elem' "dump-uplc" , poOptimize = notElem' "no-optimize" , poPedantic = elem' "pedantic" , poVerbose = elem' "verbose" @@ -392,7 +394,7 @@ runCompiler moduleName opts expr = do liftExcept $ PLC.typecheckPipeline plcTcConfig plcP uplcP <- liftExcept $ UPLC.deBruijnProgram $ UPLC.simplifyProgram $ UPLC.eraseProgram plcP - when (poDumpPlc opts) . liftIO $ dumpFlat uplcP "untyped PLC program" (moduleName ++ ".uplc.flat") + when (poDumpUPlc opts) . liftIO $ dumpFlat uplcP "untyped PLC program" (moduleName ++ ".uplc.flat") pure (spirP, uplcP) where