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
27fc635d
Commit
27fc635d
authored
11 years ago
by
Etienne Kneuss
Browse files
Options
Downloads
Patches
Plain Diff
Correctly extract methods from single case-classes
parent
f15d214d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/scala/leon/frontends/scalac/CodeExtraction.scala
+25
-19
25 additions, 19 deletions
src/main/scala/leon/frontends/scalac/CodeExtraction.scala
with
25 additions
and
19 deletions
src/main/scala/leon/frontends/scalac/CodeExtraction.scala
+
25
−
19
View file @
27fc635d
...
@@ -415,32 +415,38 @@ trait CodeExtraction extends ASTExtractors {
...
@@ -415,32 +415,38 @@ trait CodeExtraction extends ASTExtractors {
private
def
extractMethodDefs
(
defs
:
List
[
Tree
])
=
{
private
def
extractMethodDefs
(
defs
:
List
[
Tree
])
=
{
// We collect defined function bodies
// We collect defined function bodies
for
(
d
<-
defs
)
d
match
{
def
extractFromClass
(
csym
:
Symbol
,
tmpl
:
Template
)
{
case
ExAbstractClass
(
_
,
csym
,
tmpl
)
=>
val
cd
=
classesToClasses
(
csym
)
val
cd
=
classesToClasses
(
csym
)
val
ctparams
=
csym
.
tpe
match
{
val
ctparams
=
csym
.
tpe
match
{
case
TypeRef
(
_
,
_
,
tps
)
=>
case
TypeRef
(
_
,
_
,
tps
)
=>
extractTypeParams
(
tps
).
map
(
_
.
_1
)
extractTypeParams
(
tps
).
map
(
_
.
_1
)
case
_
=>
case
_
=>
Nil
Nil
}
}
val
ctparamsMap
=
ctparams
zip
cd
.
tparams
.
map
(
_
.
tp
)
val
ctparamsMap
=
ctparams
zip
cd
.
tparams
.
map
(
_
.
tp
)
for
(
d
<-
tmpl
.
body
)
d
match
{
for
(
d
<-
tmpl
.
body
)
d
match
{
case
ExFunctionDef
(
sym
,
tparams
,
params
,
_
,
body
)
=>
case
ExFunctionDef
(
sym
,
tparams
,
params
,
_
,
body
)
if
!
sym
.
isSynthetic
&&
!
sym
.
isAccessor
=>
val
fd
=
defsToDefs
(
sym
)
val
fd
=
defsToDefs
(
sym
)
val
tparamsMap
=
(
tparams
zip
fd
.
tparams
.
map
(
_
.
tp
)).
toMap
++
ctparamsMap
val
tparamsMap
=
(
tparams
zip
fd
.
tparams
.
map
(
_
.
tp
)).
toMap
++
ctparamsMap
if
(
body
!=
EmptyTree
)
{
if
(
body
!=
EmptyTree
)
{
extractFunBody
(
fd
,
params
,
body
)(
DefContext
(
tparamsMap
))
extractFunBody
(
fd
,
params
,
body
)(
DefContext
(
tparamsMap
))
}
}
case
_
=>
case
_
=>
}
}
}
for
(
d
<-
defs
)
d
match
{
case
ExAbstractClass
(
_
,
csym
,
tmpl
)
=>
extractFromClass
(
csym
,
tmpl
)
case
ExCaseClass
(
_
,
csym
,
_
,
tmpl
)
=>
extractFromClass
(
csym
,
tmpl
)
case
_
=>
case
_
=>
}
}
...
...
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