Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inox
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LARA
inox
Commits
2caaa959
Commit
2caaa959
authored
9 years ago
by
Manos Koukoutos
Browse files
Options
Downloads
Patches
Plain Diff
Refactor TypedFunDef
parent
2edb6f85
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/scala/leon/purescala/Definitions.scala
+9
-34
9 additions, 34 deletions
src/main/scala/leon/purescala/Definitions.scala
src/main/scala/leon/termination/StructuralSize.scala
+1
-1
1 addition, 1 deletion
src/main/scala/leon/termination/StructuralSize.scala
with
10 additions
and
35 deletions
src/main/scala/leon/purescala/Definitions.scala
+
9
−
34
View file @
2caaa959
...
...
@@ -59,8 +59,7 @@ object Definitions {
def
toVariable
:
Variable
=
Variable
(
id
)
}
/** A wrapper for a program. For now a program is simply a single object. The
* name is meaningless and we just use the package name as id. */
/** A wrapper for a program. For now a program is simply a single object. */
case
class
Program
(
units
:
List
[
UnitDef
])
extends
Definition
{
val
id
=
FreshIdentifier
(
"program"
)
...
...
@@ -481,43 +480,19 @@ object Definitions {
lazy
val
returnType
:
TypeTree
=
translated
(
fd
.
returnType
)
private
var
trCache
=
Map
[
Expr
,
Expr
]()
private
var
postCache
=
Map
[
Expr
,
Expr
]()
def
fullBody
=
{
val
fb
=
fd
.
fullBody
trCache
.
getOrElse
(
fb
,
{
val
res
=
translated
(
fb
)
trCache
+=
fb
->
res
private
def
cached
(
e
:
Expr
)
:
Expr
=
{
trCache
.
getOrElse
(
e
,
{
val
res
=
translated
(
e
)
trCache
+=
e
->
res
res
})
}
def
body
=
fd
.
body
.
map
{
b
=>
trCache
.
getOrElse
(
b
,
{
val
res
=
translated
(
b
)
trCache
+=
b
->
res
res
})
}
def
precondition
=
fd
.
precondition
.
map
{
pre
=>
trCache
.
getOrElse
(
pre
,
{
val
res
=
translated
(
pre
)
trCache
+=
pre
->
res
res
})
}
def
postcondition
=
fd
.
postcondition
.
map
{
case
post
if
typesMap
.
nonEmpty
=>
postCache
.
getOrElse
(
post
,
{
val
res
=
instantiateType
(
post
,
typesMap
,
paramsMap
)
postCache
+=
(
post
->
res
)
res
})
case
p
=>
p
}
def
fullBody
=
cached
(
fd
.
fullBody
)
def
body
=
fd
.
body
map
cached
def
precondition
=
fd
.
precondition
map
cached
def
postcondition
=
fd
.
postcondition
map
cached
def
hasImplementation
=
body
.
isDefined
def
hasBody
=
hasImplementation
...
...
This diff is collapsed.
Click to expand it.
src/main/scala/leon/termination/StructuralSize.scala
+
1
−
1
View file @
2caaa959
...
...
@@ -35,7 +35,7 @@ trait StructuralSize {
Variable
(
x
),
uminus
(
Variable
(
x
))
))
TypedFunDef
(
absFun
,
Seq
())
// Seq() because no generic type params
absFun
.
typed
}
def
size
(
expr
:
Expr
)
:
Expr
=
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment