From ed37907d4fe426ba804fee9d6c7c4062ae4cce5f Mon Sep 17 00:00:00 2001 From: Adriaan Moors Date: Tue, 12 Nov 2013 14:18:52 -0800 Subject: Refactoring to prepare modularization of the compiler. Actual modularization is delayed until 2.12. The one big (one-line) change is to make the interactive compiler independent of scaladoc. We have one "integration test": `MemoryLeaksTest`. This commit adds a bunch of comments marked `TODO: modularize the compiler`, that should be uncommented when we're ready to continue the modularization effort. I decided to merge them commented out to avoid having to rebase xml patches. There's still some chance of bitrot, but I'm willing to take my chances. I previously refactored the build to make it easier to add jars in a coherent way, which hinges on the `init-project-prop` mechanism, so the relevant properties are already injected there. --- src/interactive/scala/tools/nsc/interactive/Global.scala | 8 -------- .../interactive/tests/core/PresentationCompilerInstance.scala | 10 ++-------- 2 files changed, 2 insertions(+), 16 deletions(-) (limited to 'src/interactive') diff --git a/src/interactive/scala/tools/nsc/interactive/Global.scala b/src/interactive/scala/tools/nsc/interactive/Global.scala index 736a1e68c4..94f9aef38b 100644 --- a/src/interactive/scala/tools/nsc/interactive/Global.scala +++ b/src/interactive/scala/tools/nsc/interactive/Global.scala @@ -13,7 +13,6 @@ import scala.tools.nsc.io.AbstractFile import scala.reflect.internal.util.{ SourceFile, BatchSourceFile, Position, NoPosition } import scala.tools.nsc.reporters._ import scala.tools.nsc.symtab._ -import scala.tools.nsc.doc.ScaladocAnalyzer import scala.tools.nsc.typechecker.Analyzer import symtab.Flags.{ACCESSOR, PARAMACCESSOR} import scala.annotation.{ elidable, tailrec } @@ -32,13 +31,6 @@ trait CommentPreservingTypers extends Typers { override def resetDocComments() = {} } -trait InteractiveScaladocAnalyzer extends InteractiveAnalyzer with ScaladocAnalyzer { - val global : Global - override def newTyper(context: Context) = new Typer(context) with InteractiveTyper with ScaladocTyper { - override def canAdaptConstantTypeToLiteral = false - } -} - trait InteractiveAnalyzer extends Analyzer { val global : Global import global._ diff --git a/src/interactive/scala/tools/nsc/interactive/tests/core/PresentationCompilerInstance.scala b/src/interactive/scala/tools/nsc/interactive/tests/core/PresentationCompilerInstance.scala index 9a2abd5139..29e546f9fe 100644 --- a/src/interactive/scala/tools/nsc/interactive/tests/core/PresentationCompilerInstance.scala +++ b/src/interactive/scala/tools/nsc/interactive/tests/core/PresentationCompilerInstance.scala @@ -7,22 +7,16 @@ import reporters.{Reporter => CompilerReporter} /** Trait encapsulating the creation of a presentation compiler's instance.*/ private[tests] trait PresentationCompilerInstance extends TestSettings { protected val settings = new Settings - protected val withDocComments = false protected val compilerReporter: CompilerReporter = new InteractiveReporter { override def compiler = PresentationCompilerInstance.this.compiler } - private class ScaladocEnabledGlobal extends Global(settings, compilerReporter) { - override lazy val analyzer = new { - val global: ScaladocEnabledGlobal.this.type = ScaladocEnabledGlobal.this - } with InteractiveScaladocAnalyzer - } + protected def createGlobal: Global = new Global(settings, compilerReporter) protected lazy val compiler: Global = { prepareSettings(settings) - if (withDocComments) new ScaladocEnabledGlobal - else new Global(settings, compilerReporter) + createGlobal } /** -- cgit v1.2.3