Skip to content
Snippets Groups Projects
Commit fecfef7f authored by Nicolas Voirol's avatar Nicolas Voirol
Browse files

Better TreeDeconstructor instantiation system

parent a2a57136
Branches
Tags
No related merge requests found
......@@ -231,14 +231,19 @@ trait TreeDeconstructor {
* [[TreeDeconstructor]] instance. */
trait Extractors { self: Trees =>
val deconstructor: TreeDeconstructor {
def getDeconstructor(that: Trees): TreeDeconstructor {
val s: self.type
val t: self.type
val t: that.type
} = new TreeDeconstructor {
protected val s: self.type = self
protected val t: self.type = self
protected val t: that.type = that
}
val deconstructor: TreeDeconstructor {
val s: self.type
val t: self.type
} = getDeconstructor(self)
/** Operator Extractor to extract any Expression in a consistent way.
*
* You can match on any Inox Expr, and then get both a Seq[Expr] of
......
......@@ -12,11 +12,6 @@ trait TreeOps { self: Trees =>
trait SelfTreeTransformer extends TreeTransformer {
val s: self.type = self
val t: self.type = self
lazy val deconstructor: TreeDeconstructor {
val s: self.type
val t: self.type
} = self.deconstructor
}
trait IdentityTreeTransformer extends SelfTreeTransformer {
......@@ -57,10 +52,10 @@ trait TreeTransformer {
val s: Trees
val t: Trees
val deconstructor: TreeDeconstructor {
lazy val deconstructor: TreeDeconstructor {
val s: TreeTransformer.this.s.type
val t: TreeTransformer.this.t.type
}
} = s.getDeconstructor(t)
def transform(id: Identifier, tpe: s.Type): (Identifier, t.Type) = (id, transform(tpe))
......@@ -231,14 +226,6 @@ trait TreeTransformer {
} = new TreeTransformerComposition {
val t1: TreeTransformer.this.type = TreeTransformer.this
val t2: that.type = that
lazy val deconstructor: TreeDeconstructor {
val s: TreeTransformer.this.s.type
val t: that.t.type
} = new TreeDeconstructor {
protected val s: TreeTransformer.this.s.type = TreeTransformer.this.s
protected val t: that.t.type = that.t
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment