diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-04-08 13:36:57 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2014-04-11 14:22:05 +0200 |
commit | 94716b9780c3bd3770bba43aee06e46b00375904 (patch) | |
tree | f586f07d78e248ea9784d8017399eab499799655 /src/dotty/tools/dotc/core/SymDenotations.scala | |
parent | 37502919ab964e7a3dc0ca79daf2a7f83747e434 (diff) | |
download | dotty-94716b9780c3bd3770bba43aee06e46b00375904.tar.gz dotty-94716b9780c3bd3770bba43aee06e46b00375904.tar.bz2 dotty-94716b9780c3bd3770bba43aee06e46b00375904.zip |
SymDenotation.isEffectivelyFinal
Helper method that tests weather this particular
SymDenotation cant have overrides: eg if it's defined in module class,
if it is inner method, if it is method of anonymous class, etc.
Diffstat (limited to 'src/dotty/tools/dotc/core/SymDenotations.scala')
-rw-r--r-- | src/dotty/tools/dotc/core/SymDenotations.scala | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/dotty/tools/dotc/core/SymDenotations.scala b/src/dotty/tools/dotc/core/SymDenotations.scala index dc76999f6..9cf06ec47 100644 --- a/src/dotty/tools/dotc/core/SymDenotations.scala +++ b/src/dotty/tools/dotc/core/SymDenotations.scala @@ -586,6 +586,12 @@ object SymDenotations { final def enclosingClass(implicit ctx: Context): Symbol = if (isClass || !exists) symbol else owner.enclosingClass + final def isEffectivelyFinal(implicit ctx: Context): Boolean = { + (this.flags is Flags.PrivateOrFinal) || (!this.owner.isClass) || + ((this.owner.flags is (Flags.ModuleOrFinal)) && (!this.flags.is(Flags.MutableOrLazy))) || + (this.owner.isAnonymousClass) + } + /** The class containing this denotation which has the given effective name. */ final def enclosingClassNamed(name: Name)(implicit ctx: Context): Symbol = { |