summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2012-07-17 15:21:38 +0200
committerEugene Burmako <xeno.by@gmail.com>2012-07-20 10:05:00 +0200
commit96036b35698f735fd0e91aead8085519b5c3ce43 (patch)
tree0a97235423b4f7c578d0f53cb31f772cef1c6e61
parentdc7cef8ad4d5bbc4c7453eb6c137a220ab16f1f1 (diff)
downloadscala-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.
-rw-r--r--src/compiler/scala/reflect/makro/runtime/Context.scala3
-rw-r--r--src/compiler/scala/reflect/makro/runtime/Mirrors.scala43
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