diff options
author | Eugene Burmako <xeno.by@gmail.com> | 2012-09-26 10:01:24 +0200 |
---|---|---|
committer | Eugene Burmako <xeno.by@gmail.com> | 2012-09-27 15:53:15 +0200 |
commit | 7742c71c8896d06e5c9b8cc885efbc2cbf7edb69 (patch) | |
tree | 7cbeeb3b20a7e9aa50bb7cccb2c1b92f0e4f75da | |
parent | e74c432fdbce2b3eaaddcba8c733cf7ccc0ee2ed (diff) | |
download | scala-7742c71c8896d06e5c9b8cc885efbc2cbf7edb69.tar.gz scala-7742c71c8896d06e5c9b8cc885efbc2cbf7edb69.tar.bz2 scala-7742c71c8896d06e5c9b8cc885efbc2cbf7edb69.zip |
gets rid of macros.Infrastructure
currentRun goes to Enclosures and becomes enclosingRun
currentClassPath gets integrated into Run
8 files changed, 12 insertions, 32 deletions
diff --git a/src/compiler/scala/reflect/macros/runtime/Context.scala b/src/compiler/scala/reflect/macros/runtime/Context.scala index aa5dfc47b2..b3d4d50f07 100644 --- a/src/compiler/scala/reflect/macros/runtime/Context.scala +++ b/src/compiler/scala/reflect/macros/runtime/Context.scala @@ -5,7 +5,6 @@ import scala.tools.nsc.Global abstract class Context extends scala.reflect.macros.Context with Aliases - with Infrastructure with Enclosures with Names with Reifiers diff --git a/src/compiler/scala/reflect/macros/runtime/Enclosures.scala b/src/compiler/scala/reflect/macros/runtime/Enclosures.scala index b5c988ca83..be5f2dbe83 100644 --- a/src/compiler/scala/reflect/macros/runtime/Enclosures.scala +++ b/src/compiler/scala/reflect/macros/runtime/Enclosures.scala @@ -19,5 +19,6 @@ trait Enclosures { val enclosingMacros: List[Context] = this :: universe.analyzer.openMacros // include self val enclosingMethod: Tree = site.enclMethod.tree val enclosingPosition: Position = if (enclPoses.isEmpty) NoPosition else enclPoses.head.pos - val enclosingUnit: CompilationUnit = currentRun.currentUnit + val enclosingUnit: CompilationUnit = universe.currentRun.currentUnit + val enclosingRun: Run = universe.currentRun } diff --git a/src/compiler/scala/reflect/macros/runtime/Infrastructure.scala b/src/compiler/scala/reflect/macros/runtime/Infrastructure.scala deleted file mode 100644 index 3a1df5f7ce..0000000000 --- a/src/compiler/scala/reflect/macros/runtime/Infrastructure.scala +++ /dev/null @@ -1,13 +0,0 @@ -package scala.reflect.macros -package runtime - -import scala.tools.nsc.util.ScalaClassLoader - -trait Infrastructure { - self: Context => - - val currentRun: Run = universe.currentRun - - val currentClassPath: List[java.net.URL] = universe.classPath.asURLs - -} diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala index 708824ede1..8a9db2d4f0 100644 --- a/src/compiler/scala/tools/nsc/Global.scala +++ b/src/compiler/scala/tools/nsc/Global.scala @@ -1230,6 +1230,8 @@ class Global(var currentSettings: Settings, var reporter: Reporter) /** Has any macro expansion used a fallback during this run? */ var seenMacroExpansionsFallingBack = false + val classPath: List[java.net.URL] = Global.this.classPath.asURLs + /** To be initialized from firstPhase. */ private var terminalPhase: Phase = NoPhase @@ -1327,7 +1329,7 @@ class Global(var currentSettings: Settings, var reporter: Reporter) } } for (fullname <- toReload) - classPath.findClass(fullname) match { + Global.this.classPath.findClass(fullname) match { case Some(classRep) => if (settings.verbose.value) inform("[reset] reinit "+fullname) loaders.initializeFromClassPath(root, classRep) diff --git a/src/reflect/scala/reflect/macros/Context.scala b/src/reflect/scala/reflect/macros/Context.scala index 16ebbe7259..7bc34c6556 100644 --- a/src/reflect/scala/reflect/macros/Context.scala +++ b/src/reflect/scala/reflect/macros/Context.scala @@ -7,7 +7,6 @@ package macros trait Context extends Aliases with Enclosures - with Infrastructure with Names with Reifiers with FrontEnds diff --git a/src/reflect/scala/reflect/macros/Enclosures.scala b/src/reflect/scala/reflect/macros/Enclosures.scala index a07ff85a08..218cf6ebb3 100644 --- a/src/reflect/scala/reflect/macros/Enclosures.scala +++ b/src/reflect/scala/reflect/macros/Enclosures.scala @@ -47,4 +47,8 @@ trait Enclosures { /** Compilation unit that contains this macro application. */ val enclosingUnit: CompilationUnit + + /** Compilation run that contains this macro application. + */ + val enclosingRun: Run }
\ No newline at end of file diff --git a/src/reflect/scala/reflect/macros/Infrastructure.scala b/src/reflect/scala/reflect/macros/Infrastructure.scala deleted file mode 100644 index 2b0af6857b..0000000000 --- a/src/reflect/scala/reflect/macros/Infrastructure.scala +++ /dev/null @@ -1,15 +0,0 @@ -package scala.reflect -package macros - -trait Infrastructure { - self: Context => - - /** Exposes current compilation run. - */ - val currentRun: Run - - /** Exposes current classpath. - */ - val currentClassPath: List[java.net.URL] - -} diff --git a/src/reflect/scala/reflect/macros/Universe.scala b/src/reflect/scala/reflect/macros/Universe.scala index 97d0a8d98a..0aa3e1fa6a 100644 --- a/src/reflect/scala/reflect/macros/Universe.scala +++ b/src/reflect/scala/reflect/macros/Universe.scala @@ -135,6 +135,9 @@ abstract class Universe extends scala.reflect.api.Universe { /** All units of work comprising this compilation run. */ def units: Iterator[CompilationUnit] + + /** Classpath of this compilation run. */ + def classPath: List[java.net.URL] } type CompilationUnit <: CompilationUnitContextApi |