diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/ast/tpd.scala | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/ast/tpd.scala b/src/dotty/tools/dotc/ast/tpd.scala index 0dce4c324..4de98d8f8 100644 --- a/src/dotty/tools/dotc/ast/tpd.scala +++ b/src/dotty/tools/dotc/ast/tpd.scala @@ -330,6 +330,9 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { def deepFold[T](z: T)(op: (T, tpd.Tree) => T) = new DeepFolder(op).apply(z, tree) + def find[T](pred: (tpd.Tree) => Boolean): Option[tpd.Tree] = + shallowFold[Option[tpd.Tree]](None)((accum, tree) => if (pred(tree)) Some(tree) else accum) + def subst(from: List[Symbol], to: List[Symbol])(implicit ctx: Context): ThisTree = new TreeMapper(typeMap = new ctx.SubstSymMap(from, to)).apply(tree) |