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
2f8ee303
Commit
2f8ee303
authored
Feb 09, 2020
by
Zachary Snow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
keyword args conversion covers tasks
parent
14644cd1
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
58 additions
and
10 deletions
+58
-10
src/Convert/KWArgs.hs
+22
-10
test/basic/kwargs.sv
+17
-0
test/basic/kwargs.v
+19
-0
No files found.
src/Convert/KWArgs.hs
View file @
2f8ee303
...
@@ -24,11 +24,13 @@ convert = map $ traverseDescriptions convertDescription
...
@@ -24,11 +24,13 @@ convert = map $ traverseDescriptions convertDescription
convertDescription
::
Description
->
Description
convertDescription
::
Description
->
Description
convertDescription
description
=
convertDescription
description
=
traverseModuleItems
traverseModuleItems
(
convertModuleItem
tfs
)
description
(
traverseExprs
$
traverseNestedExprs
$
convertExpr
tfs
)
where
tfs
=
execWriter
$
collectModuleItemsM
collectTF
description
description
where
convertModuleItem
::
TFs
->
ModuleItem
->
ModuleItem
tfs
=
execWriter
$
collectModuleItemsM
collectTF
description
convertModuleItem
tfs
=
(
traverseExprs
$
traverseNestedExprs
$
convertExpr
tfs
)
.
(
traverseStmts
$
convertStmt
tfs
)
collectTF
::
ModuleItem
->
Writer
TFs
()
collectTF
::
ModuleItem
->
Writer
TFs
()
collectTF
(
MIPackageItem
(
Function
_
_
f
decls
_
))
=
collectTFDecls
f
decls
collectTF
(
MIPackageItem
(
Function
_
_
f
decls
_
))
=
collectTFDecls
f
decls
...
@@ -44,12 +46,22 @@ collectTFDecls name decls =
...
@@ -44,12 +46,22 @@ collectTFDecls name decls =
getInput
_
=
Nothing
getInput
_
=
Nothing
convertExpr
::
TFs
->
Expr
->
Expr
convertExpr
::
TFs
->
Expr
->
Expr
convertExpr
_
(
orig
@
(
Call
_
(
Args
_
[]
)))
=
orig
convertExpr
tfs
(
Call
expr
args
)
=
convertExpr
tfs
(
Call
(
Ident
func
)
(
Args
pnArgs
kwArgs
))
=
convertInvoke
tfs
Call
expr
args
convertExpr
_
other
=
other
convertStmt
::
TFs
->
Stmt
->
Stmt
convertStmt
tfs
(
Subroutine
expr
args
)
=
convertInvoke
tfs
Subroutine
expr
args
convertStmt
_
other
=
other
convertInvoke
::
TFs
->
(
Expr
->
Args
->
a
)
->
Expr
->
Args
->
a
convertInvoke
tfs
constructor
(
Ident
func
)
(
Args
pnArgs
(
kwArgs
@
(
_
:
_
)))
=
case
tfs
Map
.!?
func
of
case
tfs
Map
.!?
func
of
Nothing
->
Call
(
Ident
func
)
(
Args
pnArgs
kwArgs
)
Nothing
->
constructor
(
Ident
func
)
(
Args
pnArgs
kwArgs
)
Just
ordered
->
Call
(
Ident
func
)
(
Args
args
[]
)
Just
ordered
->
constructor
(
Ident
func
)
(
Args
args
[]
)
where
where
args
=
pnArgs
++
(
map
snd
$
sortOn
position
kwArgs
)
args
=
pnArgs
++
(
map
snd
$
sortOn
position
kwArgs
)
position
(
x
,
_
)
=
elemIndex
x
ordered
position
(
x
,
_
)
=
elemIndex
x
ordered
convertExpr
_
other
=
other
convertInvoke
_
constructor
expr
args
=
constructor
expr
args
test/basic/kwargs.sv
0 → 100644
View file @
2f8ee303
module
top
;
function
f
;
input
integer
z
;
input
integer
a
;
$
display
(
z
,
a
)
;
return
z
+
a
;
endfunction
task
t
;
input
integer
z
;
input
integer
a
;
$
display
(
z
,
a
)
;
endtask
initial
begin
$
display
(
f
(
.
a
(
3
)
,
.
z
(
7
)))
;
t
(
.
a
(
5
)
,
.
z
(
9
))
;
end
endmodule
test/basic/kwargs.v
0 → 100644
View file @
2f8ee303
module
top
;
function
f
;
input
integer
z
;
input
integer
a
;
begin
$
display
(
z
,
a
)
;
f
=
z
+
a
;
end
endfunction
task
t
;
input
integer
z
;
input
integer
a
;
$
display
(
z
,
a
)
;
endtask
initial
begin
$
display
(
f
(
7
,
3
))
;
t
(
9
,
5
)
;
end
endmodule
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