File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -38,10 +38,17 @@ trait ExprOps extends GenTreeOps {
38
38
lazy val Deconstructor = Operator
39
39
40
40
/** Replaces bottom-up variables by looking up for them in a map */
41
- def replaceFromSymbols [V <: VariableSymbol ](substs : Map [V , Expr ], expr : Expr )(implicit ev : VariableConverter [V ]): Expr = {
41
+ def replaceFromSymbols [V <: VariableSymbol ](
42
+ substs : Map [V , Expr ],
43
+ expr : Expr ,
44
+ copyPositions : Boolean = false
45
+ )(implicit ev : VariableConverter [V ]): Expr = {
42
46
new SelfTreeTransformer {
43
47
override def transform (expr : Expr ): Expr = expr match {
44
- case v : Variable => substs.getOrElse(v.to[V ], super .transform(v))
48
+ case v : Variable =>
49
+ val res = substs.getOrElse(v.to[V ], super .transform(v))
50
+ if (copyPositions) res.copiedFrom(v)
51
+ else res
45
52
case _ => super .transform(expr)
46
53
}
47
54
}.transform(expr)
You can’t perform that action at this time.
0 commit comments