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
0262a3d3
Commit
0262a3d3
authored
Sep 24, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
struct conversion visits non-asgn LHSs
parent
f4181aba
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
6 deletions
+14
-6
src/Convert/Struct.hs
+14
-6
No files found.
src/Convert/Struct.hs
View file @
0262a3d3
...
...
@@ -48,7 +48,8 @@ convertDescription (description @ Part{}) =
-- helpers for the scoped traversal
traverseModuleItemM
::
ModuleItem
->
State
Types
ModuleItem
traverseModuleItemM
item
=
traverseExprsM
traverseExprM
item
>>=
traverseLHSsM
traverseLHSM
item
>>=
traverseExprsM
traverseExprM
>>=
traverseAsgnsM
traverseAsgnM
traverseStmtM
::
Stmt
->
State
Types
Stmt
traverseStmtM
(
Subroutine
Nothing
f
args
)
=
do
...
...
@@ -56,7 +57,8 @@ convertDescription (description @ Part{}) =
return
$
uncurry
(
Subroutine
Nothing
)
$
convertCall
structs
stateTypes
f
args
traverseStmtM
stmt
=
traverseStmtExprsM
traverseExprM
stmt
>>=
traverseStmtLHSsM
traverseLHSM
stmt
>>=
traverseStmtExprsM
traverseExprM
>>=
traverseStmtAsgnsM
traverseAsgnM
traverseExprM
=
traverseNestedExprsM
$
stately
converter
...
...
@@ -64,24 +66,30 @@ convertDescription (description @ Part{}) =
converter
::
Types
->
Expr
->
Expr
converter
types
expr
=
snd
$
convertAsgn
structs
types
(
LHSIdent
""
,
expr
)
traverseLHSM
=
traverseNestedLHSsM
$
stately
converter
where
converter
::
Types
->
LHS
->
LHS
converter
types
lhs
=
fst
$
convertAsgn
structs
types
(
lhs
,
Ident
""
)
traverseAsgnM
=
stately
$
convertAsgn
structs
convertDescription
other
=
other
-- write down unstructured versions of packed struct types
collectStructM
::
Type
->
Writer
Structs
()
collectStructM
(
Struct
(
Packed
sg
)
fields
_
)
=
collectStructM'
Struct
True
sg
fields
collectStructM'
(
Struct
$
Packed
sg
)
True
sg
fields
collectStructM
(
Union
(
Packed
sg
)
fields
_
)
=
collectStructM'
Union
False
sg
fields
collectStructM'
(
Union
$
Packed
sg
)
False
sg
fields
collectStructM
_
=
return
()
collectStructM'
::
(
Packing
->
[
Field
]
->
[
Range
]
->
Type
)
::
([
Field
]
->
[
Range
]
->
Type
)
->
Bool
->
Signing
->
[
Field
]
->
Writer
Structs
()
collectStructM'
constructor
isStruct
sg
fields
=
do
if
canUnstructure
then
tell
$
Map
.
singleton
(
constructor
(
Packed
sg
)
fields
)
(
constructor
fields
)
(
unstructType
,
unstructFields
)
else
return
()
where
...
...
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