diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-07-17 15:21:38 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-07-20 10:05:00 +0200 |
commit | 96036b35698f735fd0e91aead8085519b5c3ce43 (patch) | |
tree | 0a97235423b4f7c578d0f53cb31f772cef1c6e61 /src | |
parent | dc7cef8ad4d5bbc4c7453eb6c137a220ab16f1f1 (diff) | |
download | scala-96036b35698f735fd0e91aead8085519b5c3ce43.tar.gz scala-96036b35698f735fd0e91aead8085519b5c3ce43.tar.bz2 scala-96036b35698f735fd0e91aead8085519b5c3ce43.zip |
SI-5999 removes the macro context mirror
It is impossible to enforce macro programmers to use this mirror
instead of c.universe.rootMirror, so it has to be let go.
As to packageless symbol loading, which was the sole purpose of
introducing a special mirror for macro contexts, it will be integrated
into the compiler mirror in subsequent commits.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/reflect/makro/runtime/Context.scala | 3 | ||||
-rw-r--r-- | src/compiler/scala/reflect/makro/runtime/Mirrors.scala | 43 |
2 files changed, 1 insertions, 45 deletions
diff --git a/src/compiler/scala/reflect/makro/runtime/Context.scala b/src/compiler/scala/reflect/makro/runtime/Context.scala index c7563e7b67..68964b7abb 100644 --- a/src/compiler/scala/reflect/makro/runtime/Context.scala +++ b/src/compiler/scala/reflect/makro/runtime/Context.scala @@ -8,7 +8,6 @@ abstract class Context extends scala.reflect.makro.Context with CapturedVariables with Infrastructure with Enclosures - with Mirrors with Names with Reifiers with FrontEnds @@ -23,7 +22,7 @@ abstract class Context extends scala.reflect.makro.Context val universe: Global - val mirror: MirrorOf[universe.type] = new ContextMirror + val mirror: MirrorOf[universe.type] = universe.rootMirror val callsiteTyper: universe.analyzer.Typer diff --git a/src/compiler/scala/reflect/makro/runtime/Mirrors.scala b/src/compiler/scala/reflect/makro/runtime/Mirrors.scala deleted file mode 100644 index ec970ee696..0000000000 --- a/src/compiler/scala/reflect/makro/runtime/Mirrors.scala +++ /dev/null @@ -1,43 +0,0 @@ -package scala.reflect.makro -package runtime - -import scala.tools.nsc.util.ScalaClassLoader - -trait Mirrors { - self: Context => - - import universe._ - import definitions._ - - class ContextMirror extends RootsBase(NoSymbol) { - val universe: self.universe.type = self.universe - def rootLoader: LazyType = rootMirror.rootLoader - - val RootPackage = rootMirror.RootPackage - val RootClass = rootMirror.RootClass - val EmptyPackage = rootMirror.EmptyPackage - val EmptyPackageClass = rootMirror.EmptyPackageClass - - // [Eugene++] this still doesn't solve the problem of invoking `c.typeCheck` on the code that refers to packageless symbols - override protected def mirrorMissingHook(owner: Symbol, name: Name): Symbol = { - if (owner.isRoot && isJavaClass(name.toString)) EmptyPackageClass.info decl name - else NoSymbol - } - - private lazy val libraryClasspathLoader: ClassLoader = { - val classpath = platform.classPath.asURLs - ScalaClassLoader.fromURLs(classpath) - } - - private def isJavaClass(path: String): Boolean = - try { - Class.forName(path, true, libraryClasspathLoader) - true - } catch { - case (_: ClassNotFoundException) | (_: NoClassDefFoundError) | (_: IncompatibleClassChangeError) => - false - } - - override def toString = "macro context mirror" - } -}
\ No newline at end of file |