Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sv2v
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
sv2v
Commits
3baa9cba
Commit
3baa9cba
authored
Jun 11, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
simplify typedef conversion
parent
9adb7522
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
18 deletions
+5
-18
src/Convert/Typedef.hs
+5
-18
No files found.
src/Convert/Typedef.hs
View file @
3baa9cba
...
...
@@ -18,29 +18,16 @@ import Language.SystemVerilog.AST
type
Types
=
Map
.
Map
Identifier
Type
convert
::
[
AST
]
->
[
AST
]
convert
=
traverseFiles
(
collectDescriptionsM
getTypedef
)
(
\
a
->
traverseDescriptions
$
removeTypedef
.
convertDescription
a
)
where
getTypedef
::
Description
->
Writer
Types
()
getTypedef
(
PackageItem
(
Typedef
a
b
))
=
tell
$
Map
.
singleton
b
a
getTypedef
(
Part
_
_
Interface
_
x
_
_
)
=
tell
$
Map
.
singleton
x
(
InterfaceT
x
Nothing
[]
)
getTypedef
_
=
return
()
removeTypedef
::
Description
->
Description
removeTypedef
(
PackageItem
(
Typedef
_
x
))
=
PackageItem
$
Decl
$
CommentDecl
$
"removed typedef: "
++
x
removeTypedef
other
=
other
convert
=
map
$
traverseDescriptions
convertDescription
convertDescription
::
Types
->
Description
->
Description
convertDescription
globalTypes
description
=
convertDescription
::
Description
->
Description
convertDescription
(
description
@
Part
{})
=
traverseModuleItems
(
convertTypedef
types
)
description'
where
description'
=
traverseModuleItems
(
traverseGenItems
convertGenItem
)
description
types
=
Map
.
union
globalTypes
$
execWriter
$
collectModuleItemsM
collectTypedefM
description'
types
=
execWriter
$
collectModuleItemsM
collectTypedefM
description'
convertDescription
other
=
other
convertTypedef
::
Types
->
ModuleItem
->
ModuleItem
convertTypedef
types
=
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment