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
69c2bf47
Commit
69c2bf47
authored
8 years ago
by
Nicolas Voirol
Browse files
Options
Downloads
Patches
Plain Diff
More comprehensive tree-transformers for Symbols
parent
2cbde59c
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/inox/Program.scala
+16
-16
16 additions, 16 deletions
src/main/scala/inox/Program.scala
src/main/scala/inox/ast/Definitions.scala
+1
-1
1 addition, 1 deletion
src/main/scala/inox/ast/Definitions.scala
with
17 additions
and
17 deletions
src/main/scala/inox/Program.scala
+
16
−
16
View file @
69c2bf47
...
...
@@ -16,7 +16,7 @@ import ast._
*
* ''printerOpts'' provides options for tree printers.
*/
trait
Program
{
trait
Program
{
self
=>
val
trees
:
Trees
implicit
val
symbols
:
trees.Symbols
implicit
val
ctx
:
Context
...
...
@@ -24,27 +24,27 @@ trait Program {
implicit
def
implicitProgram
:
this.
type
=
this
implicit
def
printerOpts
:
trees.PrinterOptions
=
trees
.
PrinterOptions
.
fromSymbols
(
symbols
,
ctx
)
def
transform
(
t
:
t
ree
s.Self
Transformer
)
:
Program
{
val
trees:
Program.this.trees
.
type
}
=
new
Program
{
val
trees
:
Program.this.trees.
type
=
Program
.
this
.
trees
val
symbols
=
Program
.
this
.
symbols
.
transform
(
t
)
val
ctx
=
Program
.
this
.
ctx
def
transform
(
t
:
T
reeTransformer
{
val
s:
self.trees.
type
}
)
:
Program
{
val
trees:
t.t
.
type
}
=
new
Program
{
val
trees
:
t.t.
type
=
t
.
t
val
symbols
=
self
.
symbols
.
transform
(
t
)
val
ctx
=
self
.
ctx
}
def
transform
(
t
:
SymbolTransformer
{
val
s:
trees.
type
})
:
Program
{
val
trees:
t.t.
type
}
=
new
Program
{
def
transform
(
t
:
SymbolTransformer
{
val
s:
self.
trees.
type
})
:
Program
{
val
trees:
t.t.
type
}
=
new
Program
{
val
trees
:
t.t.
type
=
t
.
t
val
symbols
=
t
.
transform
(
Program
.
this
.
symbols
)
val
ctx
=
Program
.
this
.
ctx
val
symbols
=
t
.
transform
(
self
.
symbols
)
val
ctx
=
self
.
ctx
}
def
withFunctions
(
functions
:
Seq
[
trees.FunDef
])
:
Program
{
val
trees:
Program.this
.trees.
type
}
=
new
Program
{
val
trees
:
Program.this
.trees.
type
=
Program
.
this
.
trees
val
symbols
=
Program
.
this
.
symbols
.
withFunctions
(
functions
)
val
ctx
=
Program
.
this
.
ctx
def
withFunctions
(
functions
:
Seq
[
trees.FunDef
])
:
Program
{
val
trees:
self
.trees.
type
}
=
new
Program
{
val
trees
:
self
.trees.
type
=
self
.
trees
val
symbols
=
self
.
symbols
.
withFunctions
(
functions
)
val
ctx
=
self
.
ctx
}
def
withADTs
(
adts
:
Seq
[
trees.ADTDefinition
])
:
Program
{
val
trees:
Program.this
.trees.
type
}
=
new
Program
{
val
trees
:
Program.this
.trees.
type
=
Program
.
this
.
trees
val
symbols
=
Program
.
this
.
symbols
.
withADTs
(
adts
)
val
ctx
=
Program
.
this
.
ctx
def
withADTs
(
adts
:
Seq
[
trees.ADTDefinition
])
:
Program
{
val
trees:
self
.trees.
type
}
=
new
Program
{
val
trees
:
self
.trees.
type
=
self
.
trees
val
symbols
=
self
.
symbols
.
withADTs
(
adts
)
val
ctx
=
self
.
ctx
}
}
This diff is collapsed.
Click to expand it.
src/main/scala/inox/ast/Definitions.scala
+
1
−
1
View file @
69c2bf47
...
...
@@ -136,7 +136,7 @@ trait Definitions { self: Trees =>
functions
.
map
(
p
=>
prettyPrint
(
p
.
_2
,
opts
)).
mkString
(
"\n\n"
)
}
def
transform
(
t
rans
:
Self
Transformer
)
:
Symbols
=
SymbolTransformer
(
t
rans
).
transform
(
this
)
def
transform
(
t
:
Tree
Transformer
{
val
s:
self.
type
})
:
t.t.
Symbols
=
SymbolTransformer
(
t
).
transform
(
this
)
override
def
equals
(
that
:
Any
)
:
Boolean
=
that
match
{
case
sym
:
AbstractSymbols
=>
functions
==
sym
.
functions
&&
adts
==
sym
.
adts
...
...
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