diff options
author | Martin Odersky <odersky@gmail.com> | 2016-07-27 16:37:00 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-07-27 16:37:00 +0200 |
commit | 87cff22595d70b9b85b4420e478562b99fab647b (patch) | |
tree | 4f9666508f01753448cd5f7c560e0c5fb023a93f /src/dotty/tools/dotc/core/SymDenotations.scala | |
parent | d7b1c0e018027b822266961beeeab3d87f02cbb0 (diff) | |
download | dotty-87cff22595d70b9b85b4420e478562b99fab647b.tar.gz dotty-87cff22595d70b9b85b4420e478562b99fab647b.tar.bz2 dotty-87cff22595d70b9b85b4420e478562b99fab647b.zip |
Simplify lexicallyEnclosingClass
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index ebb061c6b..9d96f2b15 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -844,18 +844,9 @@ object SymDenotations { enclClass(symbol, false) } - /** A class that in sourlce code would be lexically enclosing */ - final def lexicallyEnclosingClass(implicit ctx: Context): Symbol = { - def enclClass(sym: Symbol): Symbol = { - if (!sym.exists) - NoSymbol - else if (sym.isClass) - sym - else - enclClass(sym.owner) - } - enclClass(symbol) - } + /** A class that in source code would be lexically enclosing */ + final def lexicallyEnclosingClass(implicit ctx: Context): Symbol = + if (!exists || isClass) symbol else owner.lexicallyEnclosingClass /** A symbol is effectively final if it cannot be overridden in a subclass */ final def isEffectivelyFinal(implicit ctx: Context): Boolean = |