aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/core/SymDenotations.scala15
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 =