Skip to content

Commit

Permalink
Transform identifiers
Browse files Browse the repository at this point in the history
  • Loading branch information
jad-hamza committed Feb 17, 2021
1 parent 7e5ed12 commit 6048f68
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/scala/inox/ast/ExprOps.scala
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,11 @@ trait ExprOps extends GenTreeOps {
class Freshener(freshenChooses: Boolean = false) extends SelfTransformer {
type Env = Map[Identifier, Identifier]

override def transform(e: Expr, env: Env): Expr = e match {
case v: Variable => v.copy(id = env.getOrElse(v.id, v.id)).copiedFrom(v)
override def transform(id: Identifier, env: Env): Identifier = {
env.getOrElse(id, id)
}

override def transform(e: Expr, env: Env): Expr = e match {
case Let(vd, v, b) =>
val freshVd = vd.freshen
Let(transform(freshVd, env), transform(v, env), transform(b, env.updated(vd.id, freshVd.id))).copiedFrom(e)
Expand Down

0 comments on commit 6048f68

Please sign in to comment.