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
87db906a
Commit
87db906a
authored
8 years ago
by
Manos Koukoutos
Browse files
Options
Downloads
Patches
Plain Diff
Comments, slight improvements
parent
e0261206
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/scala/inox/ast/DSL.scala
+19
-7
19 additions, 7 deletions
src/main/scala/inox/ast/DSL.scala
with
19 additions
and
7 deletions
src/main/scala/inox/ast/DSL.scala
+
19
−
7
View file @
87db906a
...
@@ -296,15 +296,27 @@ trait DSL {
...
@@ -296,15 +296,27 @@ trait DSL {
/* Definitions */
/* Definitions */
/** Creates a [[FunDef]] given only an [[Identifier]] for the name;
* the (type) parameter [[Identifier]]s will be created fresh by this function.
*
* @param id The [[Identifier]] referring to this function.
* @param tParamNames The names of the type parameters for this function.
* @param builder A function from a Seq of type parameters (which should correspond
* to tParamNames) which, given these type parameters,
* should return
* (1) The sequence of parameters as [[ValDef]]s (see [[TypeToValDef.::]])
* (2) The return type of the function
* (3) A context which, given the parameters, will return the body of the function.
* @return A fresh and juicy [[FunDef]]
*/
def
mkFunDef
(
id
:
Identifier
)
def
mkFunDef
(
id
:
Identifier
)
(
tParamNames
:
String*
)
(
tParamNames
:
String*
)
(
paramRetB
uilder
:
Seq
[
TypeParameter
]
=>
(
b
uilder
:
Seq
[
TypeParameter
]
=>
(
Seq
[
ValDef
],
Type
,
Seq
[
Expr
]
=>
Expr
)
(
Seq
[
ValDef
],
Type
,
Seq
[
Expr
]
=>
Expr
)
)
=
{
)
=
{
val
tParams
=
tParamNames
map
TypeParameter
.
fresh
val
tParams
=
tParamNames
map
TypeParameter
.
fresh
val
tParamDefs
=
tParams
map
TypeParameterDef
val
tParamDefs
=
tParams
map
TypeParameterDef
val
(
params
,
retType
,
bodyBuilder
)
=
paramRetB
uilder
(
tParams
)
val
(
params
,
retType
,
bodyBuilder
)
=
b
uilder
(
tParams
)
val
fullBody
=
bodyBuilder
(
params
map
(
_
.
toVariable
))
val
fullBody
=
bodyBuilder
(
params
map
(
_
.
toVariable
))
new
FunDef
(
id
,
tParamDefs
,
params
,
retType
,
fullBody
,
Set
())
new
FunDef
(
id
,
tParamDefs
,
params
,
retType
,
fullBody
,
Set
())
...
@@ -318,10 +330,10 @@ trait DSL {
...
@@ -318,10 +330,10 @@ trait DSL {
new
AbstractClassDef
(
id
,
tParamDefs
,
children
,
Set
())
new
AbstractClassDef
(
id
,
tParamDefs
,
children
,
Set
())
}
}
def
mkCaseClass
Def
(
id
:
Identifier
)
def
mkCaseClass
(
id
:
Identifier
)
(
tParamNames
:
String*
)
(
tParamNames
:
String*
)
(
parent
:
Option
[
Identifier
])
(
parent
:
Option
[
Identifier
])
(
fieldBuilder
:
Seq
[
TypeParameter
]
=>
Seq
[
ValDef
])
=
{
(
fieldBuilder
:
Seq
[
TypeParameter
]
=>
Seq
[
ValDef
])
=
{
val
tParams
=
tParamNames
map
TypeParameter
.
fresh
val
tParams
=
tParamNames
map
TypeParameter
.
fresh
val
tParamDefs
=
tParams
map
TypeParameterDef
val
tParamDefs
=
tParams
map
TypeParameterDef
val
fields
=
fieldBuilder
(
tParams
)
val
fields
=
fieldBuilder
(
tParams
)
...
...
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