apply BlockDecl conversions to tasks and functions

This commit is contained in:
Zachary Snow
2019-10-11 19:31:41 -04:00
parent 5ef24d2d94
commit 3d3359d35a
+15 -3
View File
@@ -15,9 +15,21 @@ import Language.SystemVerilog.AST
convert :: [AST] -> [AST]
convert =
map
$ traverseDescriptions $ traverseModuleItems
$ traverseStmts $ convertStmt
map $ traverseDescriptions $ traverseModuleItems
(convertModuleItem . traverseStmts convertStmt)
convertModuleItem :: ModuleItem -> ModuleItem
convertModuleItem (MIPackageItem (Function ml t f decls stmts)) =
MIPackageItem $ Function ml t f decls' stmts'
where
Block Seq "" decls' stmts' = convertStmt $
Block Seq "" decls stmts
convertModuleItem (MIPackageItem (Task ml f decls stmts)) =
MIPackageItem $ Task ml f decls' stmts'
where
Block Seq "" decls' stmts' = convertStmt $
Block Seq "" decls stmts
convertModuleItem other = other
convertStmt :: Stmt -> Stmt
convertStmt (Block Seq name decls stmts) =