diff options
author | Seth Tisue <seth@tisue.net> | 2015-09-08 13:23:22 -0400 |
---|---|---|
committer | Seth Tisue <seth@tisue.net> | 2015-09-08 13:23:22 -0400 |
commit | ad17b552b8f7c3a435ad8de71cd7268f905a1b8d (patch) | |
tree | fc4093f85c79cb9dc6bfb77a62128652f32a68ec /src/compiler/scala/tools/reflect | |
parent | 468abc47999a39801f9e8672900fea797dea6611 (diff) | |
download | scala-ad17b552b8f7c3a435ad8de71cd7268f905a1b8d.tar.gz scala-ad17b552b8f7c3a435ad8de71cd7268f905a1b8d.tar.bz2 scala-ad17b552b8f7c3a435ad8de71cd7268f905a1b8d.zip |
Merge remote-tracking branch 'origin/2.11.x' into 2.12.x
only trivial merge conflicts here.
not dealing with PR #4333 in this merge because there is a substantial
conflict there -- so that's why I stopped at
63daba33ae99471175e9d7b20792324615f5999b for now
Diffstat (limited to 'src/compiler/scala/tools/reflect')
-rw-r--r-- | src/compiler/scala/tools/reflect/ReflectGlobal.scala | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/reflect/ReflectGlobal.scala b/src/compiler/scala/tools/reflect/ReflectGlobal.scala index ac63232967..e30d1ed7cd 100644 --- a/src/compiler/scala/tools/reflect/ReflectGlobal.scala +++ b/src/compiler/scala/tools/reflect/ReflectGlobal.scala @@ -1,9 +1,11 @@ package scala.tools package reflect +import scala.reflect.internal.util.ScalaClassLoader import scala.tools.nsc.Global import scala.tools.nsc.reporters.Reporter import scala.tools.nsc.Settings +import scala.tools.nsc.typechecker.Analyzer /** A version of Global that uses reflection to get class * infos, instead of reading class or source files. @@ -11,6 +13,20 @@ import scala.tools.nsc.Settings class ReflectGlobal(currentSettings: Settings, reporter: Reporter, override val rootClassLoader: ClassLoader) extends Global(currentSettings, reporter) with scala.tools.reflect.ReflectSetup with scala.reflect.runtime.SymbolTable { + override lazy val analyzer = new { + val global: ReflectGlobal.this.type = ReflectGlobal.this + } with Analyzer { + /** Obtains the classLoader used for runtime macro expansion. + * + * Macro expansion can use everything available in [[global.classPath]] or [[rootClassLoader]]. + * The [[rootClassLoader]] is used to obtain runtime defined macros. + */ + override protected def findMacroClassLoader(): ClassLoader = { + val classpath = global.classPath.asURLs + ScalaClassLoader.fromURLs(classpath, rootClassLoader) + } + } + override def transformedType(sym: Symbol) = postErasure.transformInfo(sym, erasure.transformInfo(sym, |