summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2011-01-04 17:06:20 +0000
committerIulian Dragos <jaguarul@gmail.com>2011-01-04 17:06:20 +0000
commit8ae754399d250a8f5bc66e8347949e5c5570ac34 (patch)
tree22fb480d7cc515b0ee612ef24f1523280e7009de
parentf0f0dfd9a326f949ab72786e61596cfa361069ae (diff)
downloadscala-8ae754399d250a8f5bc66e8347949e5c5570ac34.tar.gz
scala-8ae754399d250a8f5bc66e8347949e5c5570ac34.tar.bz2
scala-8ae754399d250a8f5bc66e8347949e5c5570ac34.zip
Disentangled scaladoc and the presentation comp...
Disentangled scaladoc and the presentation compiler. Now there are different flags, forInteractive and forScaladoc, instead of the overloaded onlyPresentation. While it is unfortunate to have these flags, I know of no easy way to customize the typer (the behavior they control is pretty deep into the analyzer). This shaves off around 100MB of unnecessary docComments from the presentation compiler. review by odersky, dubochet.
-rw-r--r--src/compiler/scala/tools/nsc/Global.scala4
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Scanners.scala2
-rw-r--r--src/compiler/scala/tools/nsc/doc/DocFactory.scala2
-rw-r--r--src/compiler/scala/tools/nsc/interactive/Global.scala1
-rw-r--r--src/compiler/scala/tools/nsc/javac/JavaScanners.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala14
-rw-r--r--test/disabled/run/docgenerator.scala2
8 files changed, 14 insertions, 15 deletions
diff --git a/src/compiler/scala/tools/nsc/Global.scala b/src/compiler/scala/tools/nsc/Global.scala
index 684490b84d..f3563b5dad 100644
--- a/src/compiler/scala/tools/nsc/Global.scala
+++ b/src/compiler/scala/tools/nsc/Global.scala
@@ -955,7 +955,7 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
dependencyAnalysis.saveDependencyAnalysis()
}
- /** Compile list of abstract files */
+ /** Compile list of abstract files. */
def compileFiles(files: List[AbstractFile]) {
try compileSources(files map getSourceFile)
catch { case ex: IOException => globalError(ex.getMessage()) }
@@ -1153,6 +1153,6 @@ class Global(var settings: Settings, var reporter: Reporter) extends SymbolTable
def forJVM = opt.jvm
def forMSIL = opt.msil
def forInteractive = false
- def onlyPresentation = false
+ def forScaladoc = false
def createJavadoc = false
}
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
index 7dac7466b0..26515f6e8b 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Scanners.scala
@@ -112,7 +112,7 @@ trait Scanners extends ScannersCommon {
}
/** Should doc comments be built? */
- def buildDocs: Boolean = onlyPresentation
+ def buildDocs: Boolean = forScaladoc
/** buffer for the documentation comment
*/
diff --git a/src/compiler/scala/tools/nsc/doc/DocFactory.scala b/src/compiler/scala/tools/nsc/doc/DocFactory.scala
index 4ce675cfb2..af8f759455 100644
--- a/src/compiler/scala/tools/nsc/doc/DocFactory.scala
+++ b/src/compiler/scala/tools/nsc/doc/DocFactory.scala
@@ -36,7 +36,7 @@ class DocFactory(val reporter: Reporter, val settings: doc.Settings) { processor
phasesSet += pickler
phasesSet += refchecks
}
- override def onlyPresentation = true
+ override def forScaladoc = true
lazy val addSourceless = {
val sless = new SourcelessComments { val global = compiler }
docComments ++= sless.comments
diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala
index 9c14f80a9e..48ddf7d5f6 100644
--- a/src/compiler/scala/tools/nsc/interactive/Global.scala
+++ b/src/compiler/scala/tools/nsc/interactive/Global.scala
@@ -51,7 +51,6 @@ self =>
@inline final def informIDE(msg: => String) =
if (verboseIDE) reporter.info(NoPosition, msg, true)
- override def onlyPresentation = true
override def forInteractive = true
/** A map of all loaded files to the rich compilation units that correspond to them.
diff --git a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala
index 76137ccdf4..68dd6120b3 100644
--- a/src/compiler/scala/tools/nsc/javac/JavaScanners.scala
+++ b/src/compiler/scala/tools/nsc/javac/JavaScanners.scala
@@ -652,7 +652,7 @@ trait JavaScanners extends ast.parser.ScannersCommon {
docBuffer = null
in.next
val scalaDoc = ("/**", "*/")
- if (in.ch == '*' && onlyPresentation)
+ if (in.ch == '*' && forScaladoc)
docBuffer = new StringBuilder(scalaDoc._1)
do {
do {
diff --git a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
index 985652deaa..95bf16db5b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/SuperAccessors.scala
@@ -157,7 +157,7 @@ abstract class SuperAccessors extends transform.Transform with transform.TypingT
decls.enter(s)
}
}
- if (settings.verbose.value && onlyPresentation && !sym.isAnonymousClass) {
+ if (settings.verbose.value && forScaladoc && !sym.isAnonymousClass) {
println("========== scaladoc of "+sym+" =============================")
println(toJavaDoc(expandedDocComment(sym)))
for (member <- sym.info.members) {
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index ca7e6ed379..252d089ab8 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -691,7 +691,7 @@ trait Typers extends Modes {
protected def adapt(tree: Tree, mode: Int, pt: Type, original: Tree = EmptyTree): Tree = tree.tpe match {
case atp @ AnnotatedType(_, _, _) if canAdaptAnnotations(tree, mode, pt) => // (-1)
adaptAnnotations(tree, mode, pt)
- case ct @ ConstantType(value) if inNoModes(mode, TYPEmode | FUNmode) && (ct <:< pt) && !onlyPresentation => // (0)
+ case ct @ ConstantType(value) if inNoModes(mode, TYPEmode | FUNmode) && (ct <:< pt) && !forScaladoc => // (0)
val sym = tree.symbol
if (sym != null && sym.isDeprecated) {
val msg = sym.toString + sym.locationString +" is deprecated: "+ sym.deprecationMessage.getOrElse("")
@@ -1800,7 +1800,7 @@ trait Typers extends Modes {
try {
namer.enterSyms(block.stats)
for (stat <- block.stats) {
- if (onlyPresentation && stat.isDef) {
+ if (forInteractive && stat.isDef) {
// this might be redundant now
var e = context.scope.lookupEntry(stat.symbol.name)
while ((e ne null) && (e.sym ne stat.symbol)) e = e.tail
@@ -2380,7 +2380,7 @@ trait Typers extends Modes {
* than ideal from a consistency standpoint, but it shouldn't be
* altered without due caution.
*/
- if (fun.symbol == List_apply && args.isEmpty && !onlyPresentation)
+ if (fun.symbol == List_apply && args.isEmpty && !forInteractive)
atPos(tree.pos)(gen.mkNil setType restpe)
else
constfold(treeCopy.Apply(tree, fun, args1) setType ifPatternSkipFormals(restpe))
@@ -3486,13 +3486,13 @@ trait Typers extends Modes {
setError(tree1)
}
- if (name == nme.ERROR && onlyPresentation)
+ if (name == nme.ERROR && forInteractive)
return makeErrorTree
if (!qual.tpe.widen.isErroneous)
notAMember(tree, qual, name)
- if (onlyPresentation) makeErrorTree else setError(tree)
+ if (forInteractive) makeErrorTree else setError(tree)
} else {
val tree1 = tree match {
case Select(_, _) => treeCopy.Select(tree, qual, name)
@@ -3776,7 +3776,7 @@ trait Typers extends Modes {
labelTyper(ldef).typedLabelDef(ldef)
case ddef @ DocDef(comment, defn) =>
- if (onlyPresentation && (sym ne null) && (sym ne NoSymbol)) {
+ if (forScaladoc && (sym ne null) && (sym ne NoSymbol)) {
docComments(sym) = comment
comment.defineVariables(sym)
val typer1 = newTyper(context.makeNewScope(tree, context.owner))
@@ -4065,7 +4065,7 @@ trait Typers extends Modes {
// whatever type to tree; we just have to survive until a real error message is issued.
tree setType AnyClass.tpe
case Import(expr, selectors) =>
- assert(onlyPresentation) // should not happen in normal circumstances.
+ assert(forInteractive) // should not happen in normal circumstances.
tree setType tree.symbol.tpe
case _ =>
abort("unexpected tree: " + tree.getClass + "\n" + tree)//debug
diff --git a/test/disabled/run/docgenerator.scala b/test/disabled/run/docgenerator.scala
index 8e0c7589ad..ebbc869fb1 100644
--- a/test/disabled/run/docgenerator.scala
+++ b/test/disabled/run/docgenerator.scala
@@ -124,7 +124,7 @@ object Foo2 {
phasesSet += analyzer.namerFactory
phasesSet += analyzer.typerFactory
}
- override def onlyPresentation = true
+ override def forScaladoc = true
}
if (reporter.hasErrors) {
reporter.flush()