Skip to content

Commit e5bd1fe

Browse files
committed
Simplify SymDenotations.originalOwner.
1 parent 16bd814 commit e5bd1fe

File tree

2 files changed

+1
-11
lines changed

2 files changed

+1
-11
lines changed

compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -760,10 +760,6 @@ class DottyBackendInterface(outputDirectory: AbstractFile, val superCallsMap: Ma
760760
// used to populate the EnclosingMethod attribute.
761761
// it is very tricky in presence of classes(and annonymous classes) defined inside supper calls.
762762
if (sym.exists) {
763-
/* This logic is similar to SymDenotations.originalOwner, but it cannot
764-
* easily be factored out because we need the `shiftedContext` when calling
765-
* `lexicallyEnclosingClass`.
766-
*/
767763
val validity = toDenot(sym).initial.validFor
768764
val shiftedContext = ctx.withPhase(validity.phaseId)
769765
toDenot(sym)(shiftedContext).lexicallyEnclosingClass(shiftedContext)

compiler/src/dotty/tools/dotc/core/SymDenotations.scala

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -400,13 +400,7 @@ object SymDenotations {
400400
final def originalName(implicit ctx: Context): Name = initial.effectiveName
401401

402402
/** The owner with which the denoting symbol was created. */
403-
final def originalOwner(implicit ctx: Context): Symbol =
404-
if (exists) {
405-
// There is a similar logic in DottyBackendInterface.originalLexicallyEnclosingClass (see comment there)
406-
val validity = initial.validFor
407-
val shiftedContext = ctx.withPhase(validity.phaseId)
408-
Symbols.toDenot(symbol)(shiftedContext).maybeOwner
409-
} else NoSymbol
403+
final def originalOwner(implicit ctx: Context): Symbol = initial.maybeOwner
410404

411405
/** The encoded full path name of this denotation, where outer names and inner names
412406
* are separated by `separator` strings as indicated by the given name kind.

0 commit comments

Comments
 (0)