Skip to content

Commit

Permalink
Add a specific option to dump UPLC so you can directly get the final …
Browse files Browse the repository at this point in the history
…output only
  • Loading branch information
michaelpj committed Oct 14, 2021
1 parent 7212706 commit 8ca8ba2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion plutus-tx-plugin/src/PlutusTx/Plugin.hs
Expand Up @@ -62,6 +62,7 @@ data PluginOptions = PluginOptions {
, poContextLevel :: Int
, poDumpPir :: Bool
, poDumpPlc :: Bool
, poDumpUPlc :: Bool
, poOptimize :: Bool
, poPedantic :: Bool
, poVerbose :: Bool
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 8ca8ba2

Please sign in to comment.