File tree Expand file tree Collapse file tree 1 file changed +3
-1
lines changed
compiler/src/dotty/tools/dotc/ast Expand file tree Collapse file tree 1 file changed +3
-1
lines changed Original file line number Diff line number Diff line change @@ -1190,7 +1190,9 @@ object Trees {
1190
1190
}
1191
1191
1192
1192
abstract class TreeAccumulator [X ] {
1193
+ // Ties the knot of the traversal: call `foldOver(x, tree))` to dive in the `tree` node.
1193
1194
def apply (x : X , tree : Tree )(implicit ctx : Context ): X
1195
+
1194
1196
def apply (x : X , trees : Traversable [Tree ])(implicit ctx : Context ): X = (x /: trees)(apply)
1195
1197
def foldOver (x : X , tree : Tree )(implicit ctx : Context ): X = {
1196
1198
def localCtx =
@@ -1301,7 +1303,7 @@ object Trees {
1301
1303
class ShallowFolder [X ](f : (X , Tree ) => X ) extends TreeAccumulator [X ] {
1302
1304
def apply (x : X , tree : Tree )(implicit ctx : Context ): X = {
1303
1305
val x1 = f(x, tree)
1304
- if (x1.asInstanceOf [AnyRef ] ne x1 .asInstanceOf [AnyRef ]) x1
1306
+ if (x1.asInstanceOf [AnyRef ] ne x .asInstanceOf [AnyRef ]) x1
1305
1307
else foldOver(x1, tree)
1306
1308
}
1307
1309
}
You can’t perform that action at this time.
0 commit comments