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
39e4e09d
Commit
39e4e09d
authored
8 years ago
by
Manos Koukoutos
Browse files
Options
Downloads
Patches
Plain Diff
Rename UnapplyPattern.id -> fd
parent
9af0e9ad
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/inox/ast/CallGraph.scala
+1
-1
1 addition, 1 deletion
src/main/scala/inox/ast/CallGraph.scala
src/main/scala/inox/ast/Expressions.scala
+5
-5
5 additions, 5 deletions
src/main/scala/inox/ast/Expressions.scala
with
6 additions
and
6 deletions
src/main/scala/inox/ast/CallGraph.scala
+
1
−
1
View file @
39e4e09d
...
@@ -13,7 +13,7 @@ trait CallGraph {
...
@@ -13,7 +13,7 @@ trait CallGraph {
private
def
collectCallsInPats
(
fd
:
FunDef
)(
p
:
Pattern
)
:
Set
[(
FunDef
,
FunDef
)]
=
private
def
collectCallsInPats
(
fd
:
FunDef
)(
p
:
Pattern
)
:
Set
[(
FunDef
,
FunDef
)]
=
(
p
match
{
(
p
match
{
case
u
:
UnapplyPattern
=>
Set
((
fd
,
symbols
.
getFunction
(
u
.
i
d
)))
case
u
:
UnapplyPattern
=>
Set
((
fd
,
symbols
.
getFunction
(
u
.
f
d
)))
case
_
=>
Set
()
case
_
=>
Set
()
})
++
p
.
subPatterns
.
flatMap
(
collectCallsInPats
(
fd
))
})
++
p
.
subPatterns
.
flatMap
(
collectCallsInPats
(
fd
))
...
...
This diff is collapsed.
Click to expand it.
src/main/scala/inox/ast/Expressions.scala
+
5
−
5
View file @
39e4e09d
...
@@ -272,9 +272,9 @@ trait Expressions { self: Trees =>
...
@@ -272,9 +272,9 @@ trait Expressions { self: Trees =>
}
}
/** A custom pattern defined through an object's `unapply` function */
/** A custom pattern defined through an object's `unapply` function */
case
class
UnapplyPattern
(
binder
:
Option
[
ValDef
],
i
d
:
Identifier
,
tps
:
Seq
[
Type
],
subPatterns
:
Seq
[
Pattern
])
extends
Pattern
{
case
class
UnapplyPattern
(
binder
:
Option
[
ValDef
],
f
d
:
Identifier
,
tps
:
Seq
[
Type
],
subPatterns
:
Seq
[
Pattern
])
extends
Pattern
{
// Hacky, but ok
// Hacky, but ok
def
optionType
(
implicit
s
:
Symbols
)
=
s
.
getFunction
(
i
d
,
tps
).
returnType
.
asInstanceOf
[
ClassType
]
def
optionType
(
implicit
s
:
Symbols
)
=
s
.
getFunction
(
f
d
,
tps
).
returnType
.
asInstanceOf
[
ClassType
]
def
optionChildren
(
implicit
s
:
Symbols
)
:
(
ClassType
,
ClassType
)
=
{
def
optionChildren
(
implicit
s
:
Symbols
)
:
(
ClassType
,
ClassType
)
=
{
val
children
=
optionType
.
tcd
.
asInstanceOf
[
TypedAbstractClassDef
].
descendants
.
sortBy
(
_
.
fields
.
size
)
val
children
=
optionType
.
tcd
.
asInstanceOf
[
TypedAbstractClassDef
].
descendants
.
sortBy
(
_
.
fields
.
size
)
val
Seq
(
noneType
,
someType
)
=
children
.
map
(
_
.
toType
)
val
Seq
(
noneType
,
someType
)
=
children
.
map
(
_
.
toType
)
...
@@ -297,7 +297,7 @@ trait Expressions { self: Trees =>
...
@@ -297,7 +297,7 @@ trait Expressions { self: Trees =>
val
vd
=
ValDef
(
FreshIdentifier
(
"unap"
,
true
),
optionType
)
val
vd
=
ValDef
(
FreshIdentifier
(
"unap"
,
true
),
optionType
)
Let
(
Let
(
vd
,
vd
,
FunctionInvocation
(
i
d
,
tps
,
Seq
(
scrut
)),
FunctionInvocation
(
f
d
,
tps
,
Seq
(
scrut
)),
IfExpr
(
IfExpr
(
IsInstanceOf
(
vd
.
toVariable
,
someType
),
IsInstanceOf
(
vd
.
toVariable
,
someType
),
someCase
(
CaseClassSelector
(
someType
,
vd
.
toVariable
,
someValue
.
id
)),
someCase
(
CaseClassSelector
(
someType
,
vd
.
toVariable
,
someValue
.
id
)),
...
@@ -318,12 +318,12 @@ trait Expressions { self: Trees =>
...
@@ -318,12 +318,12 @@ trait Expressions { self: Trees =>
*/
*/
def
getUnsafe
(
scrut
:
Expr
)(
implicit
s
:
Symbols
)
=
CaseClassSelector
(
def
getUnsafe
(
scrut
:
Expr
)(
implicit
s
:
Symbols
)
=
CaseClassSelector
(
someType
,
someType
,
FunctionInvocation
(
i
d
,
tps
,
Seq
(
scrut
)),
FunctionInvocation
(
f
d
,
tps
,
Seq
(
scrut
)),
someValue
.
id
someValue
.
id
)
)
def
isSome
(
scrut
:
Expr
)(
implicit
s
:
Symbols
)
=
def
isSome
(
scrut
:
Expr
)(
implicit
s
:
Symbols
)
=
IsInstanceOf
(
FunctionInvocation
(
i
d
,
tps
,
Seq
(
scrut
)),
someType
)
IsInstanceOf
(
FunctionInvocation
(
f
d
,
tps
,
Seq
(
scrut
)),
someType
)
}
}
// Extracts without taking care of the binder. (contrary to Extractos.Pattern)
// Extracts without taking care of the binder. (contrary to Extractos.Pattern)
...
...
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