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
0fb97f23
Commit
0fb97f23
authored
Jun 20, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove over-specified traversal arguments
parent
2535d689
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
15 deletions
+12
-15
src/Convert/Traverse.hs
+12
-15
No files found.
src/Convert/Traverse.hs
View file @
0fb97f23
...
...
@@ -208,8 +208,7 @@ collectStmtsM = collectStmtsM' IncludeTFs
-- higher levels up
traverseNestedStmtsM
::
Monad
m
=>
MapperM
m
Stmt
->
MapperM
m
Stmt
traverseNestedStmtsM
mapper
=
fullMapper
where
fullMapper
stmt
=
mapper
stmt
>>=
traverseSinglyNestedStmtsM
fullMapper
where
fullMapper
=
mapper
>=>
traverseSinglyNestedStmtsM
fullMapper
-- variant of the above which only traverses one level down
traverseSinglyNestedStmtsM
::
Monad
m
=>
MapperM
m
Stmt
->
MapperM
m
Stmt
...
...
@@ -407,7 +406,7 @@ collectStmtLHSsM = collectify traverseStmtLHSsM
traverseNestedExprsM
::
Monad
m
=>
MapperM
m
Expr
->
MapperM
m
Expr
traverseNestedExprsM
mapper
=
exprMapper
where
exprMapper
e
=
mapper
e
>>=
em
exprMapper
=
mapper
>=>
em
(
_
,
_
,
_
,
typeMapper
)
=
exprMapperHelpers
exprMapper
typeOrExprMapper
(
Left
t
)
=
typeMapper
t
>>=
return
.
Left
...
...
@@ -735,8 +734,8 @@ collectStmtExprsM :: Monad m => CollectorM m Expr -> CollectorM m Stmt
collectStmtExprsM
=
collectify
traverseStmtExprsM
traverseLHSsM'
::
Monad
m
=>
TFStrategy
->
MapperM
m
LHS
->
MapperM
m
ModuleItem
traverseLHSsM'
strat
mapper
item
=
traverseStmtsM'
strat
(
traverseStmtLHSsM
mapper
)
item
>>=
traverseModuleItemLHSsM
traverseLHSsM'
strat
mapper
=
traverseStmtsM'
strat
(
traverseStmtLHSsM
mapper
)
>=>
traverseModuleItemLHSsM
where
traverseModuleItemLHSsM
(
Assign
delay
lhs
expr
)
=
do
lhs'
<-
mapper
lhs
...
...
@@ -784,7 +783,7 @@ collectLHSsM = collectLHSsM' IncludeTFs
traverseNestedLHSsM
::
Monad
m
=>
MapperM
m
LHS
->
MapperM
m
LHS
traverseNestedLHSsM
mapper
=
fullMapper
where
fullMapper
lhs
=
mapper
lhs
>>=
tl
fullMapper
=
mapper
>=>
tl
tl
(
LHSIdent
x
)
=
return
$
LHSIdent
x
tl
(
LHSBit
l
e
)
=
fullMapper
l
>>=
\
l'
->
return
$
LHSBit
l'
e
tl
(
LHSRange
l
m
r
)
=
fullMapper
l
>>=
\
l'
->
return
$
LHSRange
l'
m
r
...
...
@@ -911,9 +910,9 @@ collectDeclTypesM :: Monad m => CollectorM m Type -> CollectorM m Decl
collectDeclTypesM
=
collectify
traverseDeclTypesM
traverseTypesM'
::
Monad
m
=>
TypeStrategy
->
MapperM
m
Type
->
MapperM
m
ModuleItem
traverseTypesM'
strategy
mapper
item
=
miMapper
item
>>=
traverseDeclsM
declMapper
>
>=
traverseTypesM'
strategy
mapper
=
miMapper
>=>
traverseDeclsM
declMapper
>
=>
traverseExprsM
(
traverseNestedExprsM
exprMapper
)
where
fullMapper
=
traverseNestedTypesM
mapper
...
...
@@ -970,9 +969,7 @@ collectGenItemsM = collectify traverseGenItemsM
-- GenModuleItems
traverseNestedGenItemsM
::
Monad
m
=>
MapperM
m
GenItem
->
MapperM
m
GenItem
traverseNestedGenItemsM
mapper
=
fullMapper
where
fullMapper
stmt
=
mapper
stmt
>>=
traverseSinglyNestedGenItemsM
fullMapper
where
fullMapper
=
mapper
>=>
traverseSinglyNestedGenItemsM
fullMapper
traverseNestedGenItems
::
Mapper
GenItem
->
Mapper
GenItem
traverseNestedGenItems
=
unmonad
traverseNestedGenItemsM
...
...
@@ -1007,7 +1004,7 @@ traverseSinglyNestedGenItemsM fullMapper = gim
traverseAsgnsM'
::
Monad
m
=>
TFStrategy
->
MapperM
m
(
LHS
,
Expr
)
->
MapperM
m
ModuleItem
traverseAsgnsM'
strat
mapper
=
moduleItemMapper
where
moduleItemMapper
item
=
miMapperA
item
>>=
miMapperB
moduleItemMapper
=
miMapperA
>=>
miMapperB
miMapperA
(
Assign
delay
lhs
expr
)
=
do
(
lhs'
,
expr'
)
<-
mapper
(
lhs
,
expr
)
...
...
@@ -1101,8 +1098,8 @@ traverseScopesM declMapper moduleItemMapper stmtMapper =
fullModuleItemMapper
where
nestedStmtMapper
stmt
=
stmtMapper
stmt
>>=
traverseSinglyNestedStmtsM
fullStmtMapper
nestedStmtMapper
=
stmtMapper
>=>
traverseSinglyNestedStmtsM
fullStmtMapper
fullStmtMapper
(
Block
kw
name
decls
stmts
)
=
do
prevState
<-
get
decls'
<-
mapM
declMapper
decls
...
...
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