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
35ac09aa
Commit
35ac09aa
authored
May 16, 2019
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
struct conversion handles complex expression nesting
parent
dadcd6ae
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
4 deletions
+32
-4
src/Convert/Struct.hs
+32
-4
No files found.
src/Convert/Struct.hs
View file @
35ac09aa
...
...
@@ -373,10 +373,38 @@ convertAsgn structs types (lhs, expr) =
retType
=
case
Map
.
lookup
f
types
of
Nothing
->
Implicit
Unspecified
[]
Just
t
->
t
-- TODO: There are other expression cases that we probably need to
-- recurse into. That said, it's not clear to me how much we really
-- expect to see things like concatenated packed structs, for example.
convertSubExpr
other
=
(
Implicit
Unspecified
[]
,
other
)
convertSubExpr
(
Call
(
Just
x
)
f
args
)
=
(
Implicit
Unspecified
[]
,
Call
(
Just
x
)
f
args
)
convertSubExpr
(
String
s
)
=
(
Implicit
Unspecified
[]
,
String
s
)
convertSubExpr
(
Number
n
)
=
(
Implicit
Unspecified
[]
,
Number
n
)
convertSubExpr
(
PSIdent
x
y
)
=
(
Implicit
Unspecified
[]
,
PSIdent
x
y
)
convertSubExpr
(
Repeat
e
es
)
=
(
Implicit
Unspecified
[]
,
Repeat
e'
es'
)
where
(
_
,
e'
)
=
convertSubExpr
e
es'
=
map
(
snd
.
convertSubExpr
)
es
convertSubExpr
(
UniOp
op
e
)
=
(
Implicit
Unspecified
[]
,
UniOp
op
e'
)
where
(
_
,
e'
)
=
convertSubExpr
e
convertSubExpr
(
Mux
a
b
c
)
=
(
t
,
Mux
a'
b'
c'
)
where
(
_
,
a'
)
=
convertSubExpr
a
(
t
,
b'
)
=
convertSubExpr
b
(
_
,
c'
)
=
convertSubExpr
c
convertSubExpr
(
Cast
(
Left
t
)
sub
)
=
(
t
,
Cast
(
Left
t
)
(
snd
$
convertSubExpr
sub
))
convertSubExpr
(
Cast
(
Right
e
)
sub
)
=
(
Implicit
Unspecified
[]
,
Cast
(
Right
e
)
(
snd
$
convertSubExpr
sub
))
convertSubExpr
(
Bits
(
Left
t
))
=
(
Implicit
Unspecified
[]
,
Bits
(
Left
t
))
convertSubExpr
(
Bits
(
Right
e
))
=
(
Implicit
Unspecified
[]
,
Bits
(
Right
e'
))
where
e'
=
snd
$
convertSubExpr
e
convertSubExpr
(
Pattern
items
)
=
(
Implicit
Unspecified
[]
,
Pattern
items'
)
where
items'
=
map
mapItem
items
mapItem
(
mx
,
e
)
=
(
mx
,
snd
$
convertSubExpr
e
)
-- lookup the range of a field in its unstructured type
lookupUnstructRange
::
TypeFunc
->
Identifier
->
Range
...
...
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