Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
clean-sapl
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
clean-and-itasks
clean-sapl
Commits
5de1bf18
Commit
5de1bf18
authored
May 02, 2016
by
Laszlo Domoszlai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
do not generate code for unused constructor arguments in "case"
parent
2d912c78
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
4 deletions
+20
-4
src/Sapl/Target/JS/CodeGeneratorJS.icl
src/Sapl/Target/JS/CodeGeneratorJS.icl
+20
-4
No files found.
src/Sapl/Target/JS/CodeGeneratorJS.icl
View file @
5de1bf18
...
...
@@ -318,6 +318,17 @@ containsUnsafeSelect s (SCase _ ps) = isUnsafeSelect s ps || any (containsUnsafe
containsUnsafeSelect
s
(
SLet
b
_)
=
containsUnsafeSelect
s
b
containsUnsafeSelect
s
_
=
False
isUsed
::
SaplTerm
SaplVar
->
Bool
isUsed
body
var
=
w
(
unpackVar
var
)
body
where
w
vn
(
SVar
bvar
)
=
unpackVar
bvar
==
vn
w
vn
(
SApplication
bvar
bargs
)
=
w
vn
bvar
||
any
(
w
vn
)
bargs
w
vn
(
SCase
bexpr
branches
)
=
w
vn
bexpr
||
any
(
w
vn
)
(
map
snd
branches
)
w
vn
(
SLet
bexpr
bdefs
)
=
w
vn
bexpr
||
any
(
w
vn
)
(
map
unpackBindExpr
bdefs
)
w
vn
(
SSelect
bexpr
_
_)
=
w
vn
bexpr
w
vn
(
SUpdate
bexpr
_
updates
)
=
w
vn
bexpr
||
any
(
w
vn
)
(
map
snd
updates
)
w
_
_
=
False
isUnsafeSelect
::
!
CoderState
![(
SaplPattern
,
SaplTerm
)]
->
Bool
isUnsafeSelect
s
patterns
=
case
ps
of
...
...
@@ -352,11 +363,16 @@ where
True
=
a
_
=
a
<++
"case "
<++
toString
get_cons
.
index
<++
": "
=
a
<++
"var "
<++
instargs
args
0
s
<++
callWrapper
body
s
#
(
fargs
,
_)
=
foldl
(\(
fs
,
i
)
a
->
if
(
isUsed
body
a
)
([(
a
,
i
):
fs
],
i
+1
)
(
fs
,
i
+1
))
([],
0
)
args
=
case
fargs
of
[]
=
a
<++
callWrapper
body
s
fargs
=
a
<++
"var "
<++
instargs
(
reverse
fargs
)
s
<++
callWrapper
body
s
where
instargs
[
t
]
i
s
a
=
a
<++
termCoder
t
s
<++
"=ys["
<++
i
+2
<++
"];"
instargs
[
t
:
ts
]
i
s
a
=
a
<++
termCoder
t
s
<++
"=ys["
<++
i
+2
<++
"],"
<++
instargs
ts
(
i
+1
)
s
instargs
[]
i
s
a
=
a
instargs
[
(
t
,
i
)]
s
a
=
a
<++
termCoder
t
s
<++
"=ys["
<++
i
+2
<++
"];"
instargs
[
(
t
,
i
):
ts
]
s
a
=
a
<++
termCoder
t
s
<++
"=ys["
<++
i
+2
<++
"],"
<++
instargs
ts
s
instargs
[]
s
a
=
a
get_cons
=
get_cons_or_die
s
cons
...
...
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