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
737791ae
Commit
737791ae
authored
Aug 27, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expose nested type traversal
parent
a9f502a6
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
5 deletions
+9
-5
src/Convert/NestPI.hs
+1
-5
src/Convert/Traverse.hs
+8
-0
No files found.
src/Convert/NestPI.hs
View file @
737791ae
...
...
@@ -55,7 +55,7 @@ traverseDescriptionM (orig @ (Part extern kw lifetime name ports items)) = do
runner
f
=
execWriter
$
collectModuleItemsM
f
orig
usedPIs
=
Set
.
unions
$
map
runner
$
[
collectStmtsM
collectSubroutinesM
,
collectTypesM
collectTypenamesM
,
collectTypesM
$
collectNestedTypesM
collectTypenamesM
,
collectExprsM
$
collectNestedExprsM
collectIdentsM
]
traverseDescriptionM
other
=
return
other
...
...
@@ -82,10 +82,6 @@ collectIdentsM _ = return ()
-- writes down aliased typenames
collectTypenamesM
::
Type
->
Writer
Idents
()
collectTypenamesM
(
Alias
_
x
_
)
=
tell
$
Set
.
singleton
x
collectTypenamesM
(
Enum
(
Just
t
)
_
_
)
=
collectTypenamesM
t
collectTypenamesM
(
Struct
_
fields
_
)
=
do
_
<-
mapM
collectTypenamesM
$
map
fst
fields
return
()
collectTypenamesM
_
=
return
()
-- returns the "name" of a package item, if it has one
...
...
src/Convert/Traverse.hs
View file @
737791ae
...
...
@@ -47,6 +47,9 @@ module Convert.Traverse
,
traverseDeclsM'
,
traverseDecls'
,
collectDeclsM'
,
traverseNestedTypesM
,
traverseNestedTypes
,
collectNestedTypesM
,
traverseTypesM
,
traverseTypes
,
collectTypesM
...
...
@@ -796,6 +799,11 @@ traverseNestedTypesM mapper = fullMapper
let
idents
=
map
snd
fields
return
$
Union
p
(
zip
types
idents
)
r
traverseNestedTypes
::
Mapper
Type
->
Mapper
Type
traverseNestedTypes
=
unmonad
traverseNestedTypesM
collectNestedTypesM
::
Monad
m
=>
CollectorM
m
Type
->
CollectorM
m
Type
collectNestedTypesM
=
collectify
traverseNestedTypesM
traverseTypesM
::
Monad
m
=>
MapperM
m
Type
->
MapperM
m
ModuleItem
traverseTypesM
mapper
item
=
miMapper
item
>>=
...
...
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