diff options
author | Martin Odersky <odersky@gmail.com> | 2014-09-21 14:48:10 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-10-11 08:24:36 +0200 |
commit | d32ff05d101f860dc1b290330d34caa9aea6e1df (patch) | |
tree | 23aad3d7ee22a375f99f772e37dc0b09ce5397c1 /src/dotty/tools/dotc/ast/TreeTypeMap.scala | |
parent | d288981f42cd8fde42340264a73d30e037bffec5 (diff) | |
download | dotty-d32ff05d101f860dc1b290330d34caa9aea6e1df.tar.gz dotty-d32ff05d101f860dc1b290330d34caa9aea6e1df.tar.bz2 dotty-d32ff05d101f860dc1b290330d34caa9aea6e1df.zip |
New utility methods in SymUtils
Diffstat (limited to 'src/dotty/tools/dotc/ast/TreeTypeMap.scala')
-rw-r--r-- | src/dotty/tools/dotc/ast/TreeTypeMap.scala | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/ast/TreeTypeMap.scala b/src/dotty/tools/dotc/ast/TreeTypeMap.scala index 56602cca9..33be848c1 100644 --- a/src/dotty/tools/dotc/ast/TreeTypeMap.scala +++ b/src/dotty/tools/dotc/ast/TreeTypeMap.scala @@ -6,6 +6,7 @@ import core._ import Types._, Contexts._, Constants._, Names._, Flags._ import SymDenotations._, Symbols._, Annotations._, Trees._, Symbols._ import Denotations._, Decorators._ +import dotty.tools.dotc.transform.SymUtils._ /** A map that applies three functions and a substitution together to a tree and * makes sure they are coordinated so that the result is well-typed. The functions are @@ -42,13 +43,7 @@ final class TreeTypeMap( import tpd._ /** If `sym` is one of `oldOwners`, replace by corresponding symbol in `newOwners` */ - def mapOwner(sym: Symbol) = { - def loop(from: List[Symbol], to: List[Symbol]): Symbol = - if (from.isEmpty) sym - else if (sym eq from.head) to.head - else loop(from.tail, to.tail) - loop(oldOwners, newOwners) - } + def mapOwner(sym: Symbol) = sym.subst(oldOwners, newOwners) /** Replace occurrences of `This(oldOwner)` in some prefix of a type * by the corresponding `This(newOwner)`. |