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
7c34f26f
Commit
7c34f26f
authored
10 years ago
by
Emmanouil (Manos) Koukoutos
Browse files
Options
Downloads
Patches
Plain Diff
Imports show to fresh Modules during MethodLifting
parent
7fedcb8b
No related branches found
No related tags found
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
+1
-1
1 addition, 1 deletion
src/main/scala/leon/purescala/Definitions.scala
src/main/scala/leon/purescala/MethodLifting.scala
+37
-28
37 additions, 28 deletions
src/main/scala/leon/purescala/MethodLifting.scala
with
38 additions
and
29 deletions
src/main/scala/leon/purescala/Definitions.scala
+
1
−
1
View file @
7c34f26f
...
@@ -116,7 +116,7 @@ object Definitions {
...
@@ -116,7 +116,7 @@ object Definitions {
abstract
class
Import
extends
Definition
{
abstract
class
Import
extends
Definition
{
def
subDefinitions
=
Nil
def
subDefinitions
=
Nil
lazy
val
importedDefs
=
this
match
{
def
importedDefs
=
this
match
{
case
PackageImport
(
pack
)
=>
{
case
PackageImport
(
pack
)
=>
{
import
DefOps._
import
DefOps._
// Ignore standalone modules, assume there are extra imports for them
// Ignore standalone modules, assume there are extra imports for them
...
...
This diff is collapsed.
Click to expand it.
src/main/scala/leon/purescala/MethodLifting.scala
+
37
−
28
View file @
7c34f26f
...
@@ -75,39 +75,48 @@ object MethodLifting extends TransformationPhase {
...
@@ -75,39 +75,48 @@ object MethodLifting extends TransformationPhase {
}(
e
)
}(
e
)
}
}
val
newUnits
=
program
.
units
map
{
u
=>
u
.
copy
(
val
modsToMods
=
(
for
{
u
<-
program
.
units
m
<-
u
.
modules
}
yield
(
m
,
{
// We remove methods from class definitions and add corresponding functions
val
newDefs
=
m
.
defs
.
flatMap
{
case
acd
:
AbstractClassDef
if
acd.methods.nonEmpty
=>
acd
+:
acd
.
methods
.
map
(
translateMethod
(
_
))
case
ccd
:
CaseClassDef
if
ccd.methods.nonEmpty
=>
ccd
+:
ccd
.
methods
.
map
(
translateMethod
(
_
))
case
fd
:
FunDef
=>
List
(
translateMethod
(
fd
))
case
d
=>
List
(
d
)
}
// finally, we clear methods from classes
m
.
defs
.
foreach
{
case
cd
:
ClassDef
=>
cd
.
clearMethods
()
case
_
=>
}
ModuleDef
(
m
.
id
,
newDefs
,
m
.
isStandalone
)
})).
toMap
val
newUnits
=
program
.
units
map
{
u
=>
u
.
copy
(
imports
=
u
.
imports
flatMap
{
imports
=
u
.
imports
flatMap
{
case
s
@SingleImport
(
c
:
ClassDef
)
=>
case
s
@SingleImport
(
c
:
ClassDef
)
=>
// If a class is imported, also add the "methods" of this class
// If a class is imported, also add the "methods" of this class
s
::
(
c
.
methods
map
{
md
=>
SingleImport
(
mdToFds
(
md
))})
s
::
(
c
.
methods
map
{
md
=>
SingleImport
(
mdToFds
(
md
))})
// If importing a ModuleDef, update to new ModuleDef
case
SingleImport
(
m
:
ModuleDef
)
=>
List
(
SingleImport
(
modsToMods
(
m
)))
case
WildcardImport
(
m
:
ModuleDef
)
=>
List
(
WildcardImport
(
modsToMods
(
m
)))
case
other
=>
List
(
other
)
case
other
=>
List
(
other
)
},
},
modules
=
u
.
modules
map
{
m
=>
modules
=
u
.
modules
map
modsToMods
// We remove methods from class definitions and add corresponding functions
val
newDefs
=
m
.
defs
.
flatMap
{
case
acd
:
AbstractClassDef
if
acd.methods.nonEmpty
=>
acd
+:
acd
.
methods
.
map
(
translateMethod
(
_
))
case
ccd
:
CaseClassDef
if
ccd.methods.nonEmpty
=>
ccd
+:
ccd
.
methods
.
map
(
translateMethod
(
_
))
case
fd
:
FunDef
=>
List
(
translateMethod
(
fd
))
case
d
=>
List
(
d
)
}
// finally, we clear methods from classes
m
.
defs
.
foreach
{
case
cd
:
ClassDef
=>
cd
.
clearMethods
()
case
_
=>
}
ModuleDef
(
m
.
id
,
newDefs
,
m
.
isStandalone
)
}
)}
)}
Program
(
program
.
id
,
newUnits
)
Program
(
program
.
id
,
newUnits
)
...
...
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