Skip to content

Commit

Permalink
optimize enclosingRootClass
Browse files Browse the repository at this point in the history
  • Loading branch information
retronym committed Dec 4, 2017
1 parent 5276119 commit 0094ced
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/reflect/scala/reflect/internal/SymbolTable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ abstract class SymbolTable extends macros.Universe
/** Is this symbol table a part of a compiler universe?
*/
def isCompilerUniverse = false
def isReflectUniverse = false

@deprecated("use enteringPhase", "2.10.0") // Used in sbt 0.12.4
@inline final def atPhase[T](ph: Phase)(op: => T): T = enteringPhase(ph)(op)
Expand Down
2 changes: 1 addition & 1 deletion src/reflect/scala/reflect/internal/Symbols.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2171,7 +2171,7 @@ trait Symbols extends api.Symbols { self: SymbolTable =>

/** The package class containing this symbol, or NoSymbol if there
* is not one. */
def enclosingRootClass: Symbol = enclosingSuchThat(_.isRoot)
def enclosingRootClass: Symbol = if (isReflectUniverse) enclosingSuchThat(_.isRoot) else rootMirror.RootClass

/** The package containing this symbol, or NoSymbol if there
* is not one. */
Expand Down
1 change: 1 addition & 0 deletions src/reflect/scala/reflect/runtime/JavaMirrors.scala
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ private[scala] trait JavaMirrors extends internal.SymbolTable with api.JavaUnive
implicit val MirrorTag: ClassTag[Mirror] = ClassTag[Mirror](classOf[JavaMirror])

override lazy val rootMirror: Mirror = createMirror(NoSymbol, rootClassLoader)
override final def isReflectUniverse = true

// overridden by ReflectGlobal
def rootClassLoader: ClassLoader = this.getClass.getClassLoader
Expand Down

0 comments on commit 0094ced

Please sign in to comment.