summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2011-09-17 15:59:16 +0000
committermichelou <michelou@epfl.ch>2011-09-17 15:59:16 +0000
commitfa0f48a5dffacf5622d1d82ec12ef0c1930354bd (patch)
treeee60ef4787fa33d8544bebaf1778206676758628 /src
parenta3ce6c471a445716a19d7402414ffda50f1d8e80 (diff)
downloadscala-fa0f48a5dffacf5622d1d82ec12ef0c1930354bd.tar.gz
scala-fa0f48a5dffacf5622d1d82ec12ef0c1930354bd.tar.bz2
scala-fa0f48a5dffacf5622d1d82ec12ef0c1930354bd.zip
fixed svn props, did some cleanup
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/reflect/internal/transform/Erasure.scala2
-rw-r--r--src/compiler/scala/tools/ant/ScalaBazaar.scala573
-rw-r--r--src/compiler/scala/tools/nsc/interpreter/ReplTokens.scala3
-rw-r--r--src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala2
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Duplicators.scala10
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/ErrorTrees.scala26
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Namers.scala6
-rw-r--r--src/library/scala/Predef.scala2
-rw-r--r--src/library/scala/package.scala2
-rw-r--r--src/library/scala/runtime/ScalaRunTime.scala9
-rw-r--r--src/library/scala/sys/process/Process.scala4
-rw-r--r--src/library/scala/xml/package.scala10
12 files changed, 372 insertions, 277 deletions
diff --git a/src/compiler/scala/reflect/internal/transform/Erasure.scala b/src/compiler/scala/reflect/internal/transform/Erasure.scala
index 6896a4aa5f..f6d94a3949 100644
--- a/src/compiler/scala/reflect/internal/transform/Erasure.scala
+++ b/src/compiler/scala/reflect/internal/transform/Erasure.scala
@@ -274,4 +274,4 @@ trait Erasure {
erasure(sym, tp)
}
}
-} \ No newline at end of file
+}
diff --git a/src/compiler/scala/tools/ant/ScalaBazaar.scala b/src/compiler/scala/tools/ant/ScalaBazaar.scala
index af2b5e1a12..f3b08faf3b 100644
--- a/src/compiler/scala/tools/ant/ScalaBazaar.scala
+++ b/src/compiler/scala/tools/ant/ScalaBazaar.scala
@@ -6,91 +6,83 @@
** |/ **
\* */
+package scala.tools
+package ant
+import scala.collection.DefaultMap
+import scala.collection.{ mutable, immutable }
-package scala.tools.ant {
-
- import scala.collection.DefaultMap
- import scala.collection.{ mutable, immutable }
- import java.io.{File, FileInputStream, FileOutputStream,
- FileWriter, StringReader}
- import java.net.URL
- import java.util.ArrayList
- import java.util.zip.{ZipOutputStream, ZipEntry}
-
- import org.apache.tools.ant.{AntClassLoader, BuildException,
- DirectoryScanner, Project}
- import org.apache.tools.ant.Task
- import org.apache.tools.ant.types.Path
- import org.apache.tools.ant.util.{FileUtils, MergingMapper,
- SourceFileScanner}
- import org.apache.tools.ant.types.{EnumeratedAttribute, Reference, FileSet}
-
- /** A set of files that can be installed at any relative location */
- class LooseFileSet {
- var destination: Option[String] = None
- def setDestination(dest: String) = {
- destination = Some(dest)
- }
+import java.io.{File, FileInputStream, FileOutputStream, FileWriter, StringReader}
+import java.util.zip.{ZipOutputStream, ZipEntry}
- var fileset: Option[FileSet] = None
- def addConfiguredFileSet(fs: FileSet) = {
- fileset = Some(fs)
- }
- }
- /** An Ant task that generates a Scala Bazaars package (sbp file) along
- * with an advertisement of that package.
- *
- * This task can take the following parameters as attributes:<ul>
- * <li>file (mandatory),</li>
- * <li>adfile,</li>
- * <li>name (mandatory),</li>
- * <li>version (mandatory),</li>
- * <li>depends,</li>
- * <li>description,</li>
- * <li>link.</li>
- * </ul>
- *
- * @author Gilles Dubochet */
- class ScalaBazaar extends Task with ScalaTask {
-
- /** The unique Ant file utilities instance to use in this task. */
- private val fileUtils = FileUtils.getFileUtils()
+import org.apache.tools.ant.{Project, Task}
+import org.apache.tools.ant.types.{FileSet, Path}
+import org.apache.tools.ant.util.FileUtils
+
+/** A set of files that can be installed at any relative location */
+class LooseFileSet {
+ var destination: Option[String] = None
+ def setDestination(dest: String) = {
+ destination = Some(dest)
+ }
+
+ var fileset: Option[FileSet] = None
+ def addConfiguredFileSet(fs: FileSet) = {
+ fileset = Some(fs)
+ }
+}
+
+/** An Ant task that generates a Scala Bazaars package (sbp file) along
+ * with an advertisement of that package.
+ *
+ * This task can take the following parameters as attributes:
+ * - `file` (mandatory),
+ * - `adfile`,
+ * - `name` (mandatory),
+ * - `version` (mandatory),
+ * - `depends`,
+ * - `description`,
+ * - `link`.
+ *
+ * @author Gilles Dubochet, Stephane Micheloud
+ */
+class ScalaBazaar extends Task with ScalaTask {
+
+ /** The unique Ant file utilities instance to use in this task. */
+ private val fileUtils = FileUtils.getFileUtils()
/******************************************************************************\
** Ant user-properties **
\******************************************************************************/
- /** The path to the archive file. */
- private var file: Option[File] = None
- /** The optional path to the advertisement file. */
- private var adfile: Option[File] = None
- /** The name of the package. */
- private var name: Option[String] = None
- /** The version number of the package. */
- private var version: Option[String] = None
- /** An (optional) list of names of the packages it depends of. */
- private var depends: List[String] = Nil
- /** An (optional) description of this package. */
- private var desc: Option[String] = None
- /** An (optional) URL link pointing to the location of the package */
- private var link: Option[String] = None
-
- /** The sets of files to include in the package */
- private object fileSetsMap extends DefaultMap[String, List[FileSet]] {
- private var content = new mutable.HashMap[String, List[FileSet]]()
- def get(key: String): Option[List[FileSet]] = content.get(key)
- override def size: Int = content.size
- def update(key: String, value: FileSet) {
- if (content.contains(key) && content(key) != Nil)
- content.update(key, value :: content(key))
- else content.update(key, List(value))
- }
- def fileSets = content.toList
- def iterator = content.iterator
+ /** The path to the archive file. */
+ private var file: Option[File] = None
+ /** The optional path to the advertisement file. */
+ private var adfile: Option[File] = None
+ /** The name of the package. */
+ private var name: Option[String] = None
+ /** The version number of the package. */
+ private var version: Option[String] = None
+ /** An (optional) list of names of the packages it depends of. */
+ private var depends: List[String] = Nil
+ /** An (optional) description of this package. */
+ private var desc: Option[String] = None
+ /** An (optional) URL link pointing to the location of the package */
+ private var link: Option[String] = None
+
+ /** The sets of files to include in the package */
+ private object fileSetsMap extends DefaultMap[String, List[FileSet]] {
+ private var content = new mutable.HashMap[String, List[FileSet]]()
+ def get(key: String): Option[List[FileSet]] = content.get(key)
+ override def size: Int = content.size
+ def update(key: String, value: FileSet) {
+ if (content.contains(key) && content(key) != Nil)
+ content.update(key, value :: content(key))
+ else content.update(key, List(value))
}
-
-
+ def fileSets = content.toList
+ def iterator = content.iterator
+ }
/******************************************************************************\
** Internal properties **
@@ -101,218 +93,289 @@ package scala.tools.ant {
** Properties setters **
\******************************************************************************/
- /** Sets the file attribute. Used by Ant.
- * @param input The value of <code>file</code>. */
- def setFile(input: File) =
- file = Some(input)
-
- /** Sets the advertisement file attribute. Used by Ant.
- * @param input The value of <code>adfile</code>. */
- def setAdfile(input: File) =
- adfile = Some(input)
-
- /** Sets the name attribute of this package. Used by Ant.
- * @param input The value of <code>name</code>. */
- def setName(input: String) =
- name = Some(input)
-
- /** Sets the version attribute of this package. Used by Ant.
- * @param input The value of <code>version</code>. */
- def setVersion(input: String) =
- version = Some(input)
-
- /** Sets the depends attribute. Used by Ant.
- * @param input The value for <code>depends</code>. */
- def setDepends(input: String) = {
- depends = input.split(",").toList.flatMap { s: String =>
- val st = s.trim()
- (if (st != "") List(st) else Nil)
- }
+ /** Sets the file attribute. Used by [[http://ant.apache.org Ant]].
+ * @param input The value of `file`.
+ */
+ def setFile(input: File) { file = Some(input) }
+
+ /** Sets the advertisement file attribute. Used by [[http://ant.apache.org Ant]].
+ * @param input The value of `adfile`.
+ */
+ def setAdfile(input: File) { adfile = Some(input) }
+
+ /** Sets the name attribute of this package. Used by [[http://ant.apache.org Ant]].
+ * @param input The value of `name`.
+ */
+ def setName(input: String) { name = Some(input) }
+
+ /** Sets the version attribute of this package. Used by [[http://ant.apache.org Ant]].
+ * @param input The value of `version`.
+ */
+ def setVersion(input: String) { version = Some(input) }
+
+ /** Sets the depends attribute. Used by [[http://ant.apache.org Ant]].
+ * @param input The value for `depends`.
+ */
+ def setDepends(input: String) = {
+ depends = (input split ",").toList.flatMap { s: String =>
+ val st = s.trim()
+ (if (st != "") List(st) else Nil)
}
+ }
- /** Sets the description attribute of this package. Used by Ant.
- * @param input The value of <code>description</code>. */
- def setDesc(input: String) =
- desc = Some(input)
+ /** Sets the description attribute of this package. Used by [[http://ant.apache.org Ant]].
+ * @param input The value of `description`.
+ */
+ def setDesc(input: String) { desc = Some(input) }
- /** Sets the link attribute of this package. Used by Ant.
- * @param input The value of <code>link</code>. */
- def setLink(input: String) =
- link = Some(input)
+ /** Sets the link attribute of this package. Used by [[http://ant.apache.org Ant]].
+ * @param input The value of `link`.
+ */
+ def setLink(input: String) { link = Some(input) }
- def addConfiguredLibset(input: FileSet) =
- fileSetsMap.update("lib", input)
+ def addConfiguredLibset(input: FileSet) =
+ fileSetsMap.update("lib", input)
- def addConfiguredBinset(input: FileSet) =
- fileSetsMap.update("bin", input)
+ def addConfiguredBinset(input: FileSet) =
+ fileSetsMap.update("bin", input)
- def addConfiguredSrcset(input: FileSet) =
- fileSetsMap.update("src", input)
+ def addConfiguredSrcset(input: FileSet) =
+ fileSetsMap.update("src", input)
- def addConfiguredManset(input: FileSet) =
- fileSetsMap.update("man", input)
+ def addConfiguredManset(input: FileSet) =
+ fileSetsMap.update("man", input)
- def addConfiguredDocset(input: FileSet) =
- fileSetsMap.update("doc/" + getName, input)
+ def addConfiguredDocset(input: FileSet) =
+ fileSetsMap.update("doc/" + getName, input)
- def addConfiguredMiscset(input: FileSet) =
- fileSetsMap.update("misc/" + getName, input)
+ def addConfiguredMiscset(input: FileSet) =
+ fileSetsMap.update("misc/" + getName, input)
- def addConfiguredLooseset(set: LooseFileSet) = {
- Pair(set.destination, set.fileset) match {
- case Pair(None, _) =>
- buildError("destination not specified for a loose file set")
+ def addConfiguredLooseset(set: LooseFileSet) = {
+ (set.destination, set.fileset) match {
+ case (None, _) =>
+ buildError("destination not specified for a loose file set")
- case Pair(_, None) =>
- buildError("no files specified for a loose file set")
+ case (_, None) =>
+ buildError("no files specified for a loose file set")
- case Pair(Some(dest), Some(fileset)) =>
- fileSetsMap.update(dest, fileset)
- }
+ case (Some(dest), Some(fileset)) =>
+ fileSetsMap.update(dest, fileset)
}
+ }
/******************************************************************************\
** Properties getters **
\******************************************************************************/
- /** Gets the value of the file attribute in a Scala-friendly form.
- * @return The file as a file. */
- private def getName: String =
- if (name.isEmpty) buildError("Name attribute must be defined first.")
- else name.get
-
- /** Gets the value of the file attribute in a Scala-friendly form.
- * @return The file as a file. */
- private def getFile: File =
- if (file.isEmpty) buildError("Member 'file' is empty.")
- else getProject().resolveFile(file.get.toString())
-
- /** Gets the value of the adfile attribute in a Scala-friendly form.
- * @return The adfile as a file. */
- private def getAdfile: File =
- if (adfile.isEmpty) buildError("Member 'adfile' is empty.")
- else getProject().resolveFile(adfile.get.toString())
+ /** Gets the value of the file attribute in a Scala-friendly form.
+ * @return The file as a file.
+ */
+ private def getName: String =
+ if (name.isEmpty) buildError("Name attribute must be defined first.")
+ else name.get
+
+ /** Gets the value of the file attribute in a Scala-friendly form.
+ * @return The file as a file.
+ */
+ private def getFile: File =
+ if (file.isEmpty) buildError("Member 'file' is empty.")
+ else getProject resolveFile file.get.toString
+
+ /** Gets the value of the adfile attribute in a Scala-friendly form.
+ * @return The adfile as a file.
+ */
+ private def getAdfile: File =
+ if (adfile.isEmpty) buildError("Member 'adfile' is empty.")
+ else getProject resolveFile adfile.get.toString
/******************************************************************************\
** Compilation and support methods **
\******************************************************************************/
- /** Transforms a string name into a file relative to the provided base
- * directory.
- * @param base A file pointing to the location relative to which the name
- * will be resolved.
- * @param name A relative or absolute path to the file as a string.
- * @return A file created from the name and the base file. */
- private def nameToFile(base: File)(name: String): File =
- existing(fileUtils.resolveFile(base, name))
-
- /** Transforms a string name into a file relative to the build root
- * directory.
- * @param name A relative or absolute path to the file as a string.
- * @return A file created from the name. */
- private def nameToFile(name: String): File =
- existing(getProject().resolveFile(name))
-
- /** Tests if a file exists and prints a warning in case it doesn't. Always
- * returns the file, even if it doesn't exist.
- * @param file A file to test for existance.
- * @return The same file. */
- private def existing(file: File): File = {
- if (!file.exists())
- log("Element '" + file.toString() + "' does not exist.",
- Project.MSG_WARN)
- file
- }
- private def writeFile(file: File, content: String) =
- if (file.exists() && !file.canWrite())
- buildError("File " + file + " is not writable")
- else {
- val writer = new FileWriter(file, false)
- writer.write(content)
- writer.close()
- }
+ /** Transforms a string name into a file relative to the provided base
+ * directory.
+ * @param base A file pointing to the location relative to which the name
+ * will be resolved.
+ * @param name A relative or absolute path to the file as a string.
+ * @return A file created from the name and the base file.
+ */
+ private def nameToFile(base: File)(name: String): File =
+ existing(fileUtils.resolveFile(base, name))
+
+ /** Transforms a string name into a file relative to the build advertDoc
+ * directory.
+ * @param name A relative or absolute path to the file as a string.
+ * @return A file created from the name.
+ */
+ private def nameToFile(name: String): File =
+ existing(getProject resolveFile name)
+
+ /** Tests if a file exists and prints a warning in case it doesn't.
+ * Always returns the file, even if it doesn't exist.
+ * @param file A file to test for existance.
+ * @return The same file.
+ */
+ private def existing(file: File): File = {
+ if (!file.exists)
+ log("Element '" + file.toString + "' does not exist.", Project.MSG_WARN)
+ file
+ }
+/*@XML*/
+ private def writeFile(file: File, content: String) {
+ if (file.exists && !file.canWrite)
+ buildError("File " + file + " is not writable")
+ else {
+ val writer = new FileWriter(file, false)
+ writer write content
+ writer.close()
+ }
+ }
+/*XML@*/
+/*@NOXML
+ private def writeFile(file: File, node: util.XML.Node) {
+ if (file.exists && !file.canWrite)
+ buildError("File " + file + " is not writable")
+ else
+ util.XML.save(file.getPath, node)
+ }
+XMLNO@*/
/******************************************************************************\
** The big execute method **
\******************************************************************************/
- /** Performs the compilation. */
- override def execute() = {
- // Tests if all mandatory attributes are set and valid.
- if (file.isEmpty) buildError("Attribute 'file' is not set.")
- if (name.isEmpty) buildError("Attribute 'name' is not set.")
- if (version.isEmpty) buildError("Attribute 'version' is not set.")
-
- val pack = {
- <package>
- <name>{name.get}</name>
- <version>{version.get}</version>{
- if (!depends.isEmpty)
- <depends>{
- for (depend <- depends) yield
- <name>{depend}</name>
- }</depends>
- else Nil
- }{
- if (!desc.isEmpty)
- <description>{desc.get}</description>
- else Nil
- }
- </package>
+ /** Performs the compilation. */
+ override def execute() {
+ // Tests if all mandatory attributes are set and valid.
+ if (file.isEmpty) buildError("Attribute 'file' is not set.")
+ if (name.isEmpty) buildError("Attribute 'name' is not set.")
+ if (version.isEmpty) buildError("Attribute 'version' is not set.")
+
+/*@NOXML
+ val advertDoc = util.XML.newDocument()
+XMLNO@*/
+
+ val pack = {
+/*@XML*/ // NB. This code DOES rely on Scala native XML support.
+ <package>
+ <name>{name.get}</name>
+ <version>{version.get}</version>{
+ if (!depends.isEmpty)
+ <depends>{
+ for (depend <- depends) yield
+ <name>{depend}</name>
+ }</depends>
+ else Nil
+ }{
+ if (!desc.isEmpty)
+ <description>{desc.get}</description>
+ else Nil
+ }
+ </package>
+/*XML@*/
+/*@NOXML // NB. This code DOES NOT rely on Scala native XML support.
+ val packageElem = advertDoc createElement "package"
+
+ val nameElem = advertDoc createElement "name"
+ nameElem appendChild (advertDoc createTextNode name.get)
+ packageElem appendChild nameElem
+
+ val versionElem = advertDoc createElement "version"
+ versionElem appendChild (advertDoc createTextNode version.get)
+ packageElem appendChild versionElem
+
+ if (!depends.isEmpty) {
+ val dependsElem = advertDoc createElement "depends"
+ for (depend <- depends) {
+ val depNameElem = advertDoc createElement "name"
+ depNameElem appendChild (advertDoc createTextNode depend)
+ dependsElem appendChild depNameElem
+ }
+ packageElem appendChild dependsElem
+ }
+ if (!desc.isEmpty) {
+ val descElem = advertDoc createElement "description"
+ descElem appendChild (advertDoc createTextNode desc.get)
+ packageElem appendChild descElem
}
- log("Creating package '" + name.get + "'")
-
- // Creates the advert file
- val advert = {
- <availablePackage>
- {pack}
- {link match {
- case None => <link>INSERT LINK HERE</link>
- case Some(str) => <link>{str}</link>
- }}
- </availablePackage>
- };
-
- if (!adfile.isEmpty)
- writeFile(getAdfile, advert.toString())
-
- // Checks for new files and creates the ZIP
-
- val zipContent =
- for {
- Pair(folder, fileSets) <- fileSetsMap.fileSets
- fileSet <- fileSets
- file <- fileSet.getDirectoryScanner(getProject).getIncludedFiles.toList
- } yield Triple(folder, fileSet.getDir(getProject), file)
- val zip = new ZipOutputStream(new FileOutputStream(file.get, false))
- if (!zipContent.isEmpty) {
- for (Triple(destFolder, srcFolder, file) <- zipContent) {
- log(file, Project.MSG_DEBUG)
- zip.putNextEntry(new ZipEntry(destFolder + "/" + file))
- val input = new FileInputStream(nameToFile(srcFolder)(file))
- val buf = new Array[Byte](10240)
- var n = input.read(buf, 0, buf.length)
- while (n >= 0) {
- zip.write (buf, 0, n)
- n = input.read(buf, 0, buf.length)
- }
- zip.closeEntry()
- input.close()
- }
- } else log("Archive contains no files.", Project.MSG_VERBOSE)
- zip.putNextEntry(new ZipEntry("meta/description"))
- val packInput = new StringReader(pack.toString())
- var byte = packInput.read()
- while (byte != -1) {
- zip.write (byte)
- byte = packInput.read()
+ packageElem
+XMLNO@*/
+ }
+
+ log("Creating package '" + name.get + "'")
+
+ // Creates the advert file
+ val advert = {
+/*@XML*/ // NB. This code DOES rely on Scala native XML support.
+ <availablePackage>
+ {pack}
+ {link match {
+ case None => <link>INSERT LINK HERE</link>
+ case Some(str) => <link>{str}</link>
+ }}
+ </availablePackage>
+/*XML@*/
+/*@NOXML // NB. This code DOES NOT rely on Scala native XML support.
+ val availPackageElem = advertDoc createElement "availablePackage"
+ availPackageElem appendChild pack
+ advertDoc appendChild availPackageElem
+ val text = link match {
+ case None => "INSERT LINK HERE"
+ case Some(str) => str
}
- zip.closeEntry()
- packInput.close()
- zip.close
+ val linkElem = advertDoc createElement "link"
+ linkElem appendChild (advertDoc createTextNode text)
+ availPackageElem appendChild linkElem
+
+ advertDoc
+XMLNO@*/
}
+/*@XML*/
+ if (!adfile.isEmpty)
+ writeFile(getAdfile, advert.toString)
+/*XML@*/
+/*@NOXML
+ if (!adfile.isEmpty)
+ writeFile(getAdfile, advertDoc)
+XMLNO@*/
+
+ // Checks for new files and creates the ZIP
+
+ val zipContent =
+ for {
+ (folder, fileSets) <- fileSetsMap.fileSets
+ fileSet <- fileSets
+ file <- fileSet.getDirectoryScanner(getProject).getIncludedFiles.toList
+ } yield Triple(folder, fileSet.getDir(getProject), file)
+ val zip = new ZipOutputStream(new FileOutputStream(file.get, false))
+ if (!zipContent.isEmpty) {
+ for (Triple(destFolder, srcFolder, file) <- zipContent) {
+ log(file, Project.MSG_DEBUG)
+ zip putNextEntry new ZipEntry(destFolder + "/" + file)
+ val input = new FileInputStream(nameToFile(srcFolder)(file))
+ val buf = new Array[Byte](10240)
+ var n = input.read(buf, 0, buf.length)
+ while (n >= 0) {
+ zip.write (buf, 0, n)
+ n = input.read(buf, 0, buf.length)
+ }
+ zip.closeEntry()
+ input.close()
+ }
+ } else log("Archive contains no files.", Project.MSG_VERBOSE)
+ zip putNextEntry new ZipEntry("meta/description")
+ val packInput = new StringReader(pack.toString)
+ var byte = packInput.read()
+ while (byte != -1) {
+ zip.write (byte)
+ byte = packInput.read()
+ }
+ zip.closeEntry()
+ packInput.close()
+ zip.close()
}
}
diff --git a/src/compiler/scala/tools/nsc/interpreter/ReplTokens.scala b/src/compiler/scala/tools/nsc/interpreter/ReplTokens.scala
index 2663eef897..4918e7133c 100644
--- a/src/compiler/scala/tools/nsc/interpreter/ReplTokens.scala
+++ b/src/compiler/scala/tools/nsc/interpreter/ReplTokens.scala
@@ -98,8 +98,9 @@ abstract class ReplTokens {
SUBTYPE -> Subtype,
SUPERTYPE -> Supertype,
TRUE -> True,
- VIEWBOUND -> ViewBound,
+ VIEWBOUND -> ViewBound/*@XML*/,
XMLSTART -> "<xmlstart>"
+/*XML@*/
)
}
def isAlphaId(t: ReplToken) = t match {
diff --git a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
index 2212a42c78..58d8003f06 100644
--- a/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
+++ b/src/compiler/scala/tools/nsc/symtab/SymbolLoaders.scala
@@ -108,7 +108,7 @@ abstract class SymbolLoaders {
})
}
- override def complete(root: Symbol) : Unit = {
+ override def complete(root: Symbol) {
def signalError(ex: Exception) {
ok = false
if (settings.debug.value) ex.printStackTrace()
diff --git a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala
index 16b01d3f05..c3d22d34e0 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Duplicators.scala
@@ -1,3 +1,8 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2011 LAMP/EPFL
+ * @author Martin Odersky
+ */
+
package scala.tools.nsc
package typechecker
@@ -7,6 +12,9 @@ import scala.collection.{ mutable, immutable }
/** Duplicate trees and re-type check them, taking care to replace
* and create fresh symbols for new local definitions.
+ *
+ * @author Iulian Dragos
+ * @version 1.0
*/
abstract class Duplicators extends Analyzer {
import global._
@@ -155,7 +163,6 @@ abstract class Duplicators extends Analyzer {
stats foreach invalidate
}
-
def retypedMethod(ddef: DefDef, oldThis: Symbol, newThis: Symbol): Tree = {
oldClassOwner = oldThis
newClassOwner = newThis
@@ -209,6 +216,7 @@ abstract class Duplicators extends Analyzer {
log("fixing tpe: " + tree.tpe + " with sym: " + tree.tpe.typeSymbol)
ttree.tpe = fixType(ttree.tpe)
ttree
+
case Block(stats, res) =>
log("invalidating block")
invalidate(stats)
diff --git a/src/compiler/scala/tools/nsc/typechecker/ErrorTrees.scala b/src/compiler/scala/tools/nsc/typechecker/ErrorTrees.scala
index 01ef8f7746..92903aabb0 100644
--- a/src/compiler/scala/tools/nsc/typechecker/ErrorTrees.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/ErrorTrees.scala
@@ -1,6 +1,15 @@
+/* NSC -- new Scala compiler
+ * Copyright 2005-2011 LAMP/EPFL
+ * @author Martin Odersky
+ */
+
package scala.tools.nsc
package typechecker
+/**
+ * @author Hubert Plociniczak
+ * @version 1.0
+ */
trait ErrorTrees {
self: Analyzer =>
@@ -17,7 +26,7 @@ trait ErrorTrees {
printName(this)
}
- trait ContextError {
+ protected trait ContextError {
def errMsg: String
def errPos: Position
def emit(context: Context) = context.error(errPos, errMsg)
@@ -50,7 +59,7 @@ trait ErrorTrees {
object quickErrorTreeFinder extends Traverser {
import scala.collection.mutable
- var found: Option[ErrorTree] = None
+ private var found: Option[ErrorTree] = None
override def traverse(t: Tree) {
if (!found.isDefined)
t match {
@@ -60,14 +69,14 @@ trait ErrorTrees {
super.traverse(t)
}
}
- def apply(t: Tree) = {
+ def apply(t: Tree): ErrorTree = {
found = None
traverse(t)
found.get
}
}
- abstract class TreeForwarder(forwardTo: Tree) extends Tree {
+ protected abstract class TreeForwarder(forwardTo: Tree) extends Tree {
override def pos = forwardTo.pos
override def hasSymbol = forwardTo.hasSymbol
override def symbol = forwardTo.symbol
@@ -191,7 +200,6 @@ trait ErrorTrees {
def errPos = tree.pos
}
-
// typedIdent
case class AmbiguousIdentError(tree: Tree, name: Name, msg: String)
extends TreeForwarder(tree) with ErrorTree with ContextError {
@@ -736,7 +744,6 @@ trait ErrorTrees {
}
}
-
// Extends ErrorTreeWithPrettyPrinter to pass presentation/ping-pong test case
case class ApplyWithoutArgsError(tree: Tree, fun: Tree)
extends TreeForwarder(tree) with ErrorTreeWithPrettyPrinter with ErrorTree {
@@ -911,7 +918,6 @@ trait ErrorTrees {
def errPos = pos0
}
-
// TODO needs test case
// cases where we do not necessairly return trees
case class DependentMethodTpeConversionToFunctionError(pos0: Position, tp: Type)
@@ -1066,7 +1072,6 @@ trait ErrorTrees {
context.error(tree.pos, "constructor cannot be instantiated to expected type" +
foundReqMsg(restpe, pt))
}
-
}
case class NoBestMethodAlternativeError(tree: Tree, argtpes: List[Type],
@@ -1077,7 +1082,6 @@ trait ErrorTrees {
if (!tree.isErroneous)
context.error(tree.pos, applyErrorMsg(tree, " cannot be applied to ", argtpes, pt))
}
-
}
case class AmbiguousMethodAlternativeError(tree: Tree, pre: Type, best: Symbol,
@@ -1155,7 +1159,6 @@ trait ErrorTrees {
def errPos = tree.pos
}
-
//checkCheckable
case class TypePatternOrIsInstanceTestError(pos0: Position, tp: Type)
extends ErrorTree with ContextError {
@@ -1237,7 +1240,6 @@ trait ErrorTrees {
extends ErrorTree {
assert(pending0.length != 0, "pending exceptions cannot be empty")
-
def emit(context: Context) {
// Try to report each, here we dont' care
// if any of those throws TypeError
@@ -1321,4 +1323,4 @@ trait ErrorTrees {
context.error(arg.pos, "positional after named argument.")
}
}
-} \ No newline at end of file
+}
diff --git a/src/compiler/scala/tools/nsc/typechecker/Namers.scala b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
index c3062b3b2e..bec5cef57a 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Namers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Namers.scala
@@ -41,8 +41,8 @@ trait Namers { self: Analyzer =>
}
}
- private class NormalNamer(context : Context) extends Namer(context)
- def newNamer(context : Context) : Namer = new NormalNamer(context)
+ private class NormalNamer(context: Context) extends Namer(context)
+ def newNamer(context: Context): Namer = new NormalNamer(context)
// In the typeCompleter (templateSig) of a case class (resp it's module),
// synthetic `copy` (reps `apply`, `unapply`) methods are added. To compute
@@ -948,7 +948,7 @@ trait Namers { self: Analyzer =>
else MethodType(params, restpe)
}
- def thisMethodType(restpe: Type) = {
+ def thisMethodType(restpe: Type) = {
import scala.collection.mutable.ListBuffer
val okParams = ListBuffer[Symbol]()
// can we relax these restrictions? see test/files/pos/depmet_implicit_oopsla_session_2.scala and neg/depmet_try_implicit.scala for motivation
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala
index 54111dceba..8a2729a3f9 100644
--- a/src/library/scala/Predef.scala
+++ b/src/library/scala/Predef.scala
@@ -114,8 +114,10 @@ object Predef extends LowPriorityImplicits {
def implicitly[T](implicit e: T) = e // for summoning implicit values from the nether world
@inline def locally[T](x: T): T = x // to communicate intent and avoid unmoored statements
+ /*@XML*/
// Apparently needed for the xml library
val $scope = scala.xml.TopScope
+ /*XML@*/
// Deprecated
diff --git a/src/library/scala/package.scala b/src/library/scala/package.scala
index 0c5d10b15e..1267e90c6d 100644
--- a/src/library/scala/package.scala
+++ b/src/library/scala/package.scala
@@ -75,10 +75,12 @@ package object scala {
@deprecated("Use Thread.currentThread instead", "2.9.0")
def currentThread = java.lang.Thread.currentThread()
+ /*@XML*/
// Moved back into Predef to avoid unnecessary indirection by
// way of the scala package object within the standard library,
// but bridged for compatibility.
@bridge def $scope = scala.xml.TopScope
+ /*XML@*/
// Numeric types which were moved into scala.math.*
diff --git a/src/library/scala/runtime/ScalaRunTime.scala b/src/library/scala/runtime/ScalaRunTime.scala
index 9162ae0fc0..3c7aff5b60 100644
--- a/src/library/scala/runtime/ScalaRunTime.scala
+++ b/src/library/scala/runtime/ScalaRunTime.scala
@@ -8,13 +8,15 @@
package scala.runtime
-import scala.reflect.ClassManifest
import scala.collection.{ Seq, IndexedSeq, TraversableView }
import scala.collection.mutable.WrappedArray
import scala.collection.immutable.{ StringLike, NumericRange, List, Stream, Nil, :: }
import scala.collection.generic.{ Sorted }
-import scala.xml.{ Node, MetaData }
import scala.util.control.ControlThrowable
+/*@XML*/
+import scala.xml.{ Node, MetaData }
+/*XML@*/
+
import java.lang.Double.doubleToLongBits
import java.lang.reflect.{ Modifier, Method => JMethod }
@@ -278,8 +280,10 @@ object ScalaRunTime {
// When doing our own iteration is dangerous
def useOwnToString(x: Any) = x match {
+ /*@XML*/
// Node extends NodeSeq extends Seq[Node] and MetaData extends Iterable[MetaData]
case _: Node | _: MetaData => true
+ /*XML@*/
// Range/NumericRange have a custom toString to avoid walking a gazillion elements
case _: Range | _: NumericRange[_] => true
// Sorted collections to the wrong thing (for us) on iteration - ticket #3493
@@ -334,6 +338,7 @@ object ScalaRunTime {
case _: StackOverflowError | _: UnsupportedOperationException | _: AssertionError => "" + arg
}
}
+
/** stringOf formatted for use in a repl result. */
def replStringOf(arg: Any, maxElements: Int): String = {
val s = stringOf(arg, maxElements)
diff --git a/src/library/scala/sys/process/Process.scala b/src/library/scala/sys/process/Process.scala
index db10ff9c1d..ff02b38fd3 100644
--- a/src/library/scala/sys/process/Process.scala
+++ b/src/library/scala/sys/process/Process.scala
@@ -132,7 +132,9 @@ trait ProcessCreation {
* apply(<x> {dxPath.absolutePath} --dex --output={classesDexPath.absolutePath} {classesMinJarPath.absolutePath}</x>)
* }}}
*/
+ /*@XML*/
def apply(command: scala.xml.Elem): ProcessBuilder = apply(command.text.trim)
+ /*XML@*/
/** Create a [[scala.sys.process.ProcessBuilder]] from a `Boolean`. This can be
* to force an exit value.
@@ -205,7 +207,9 @@ trait ProcessImplicits {
implicit def urlToProcess(url: URL): URLBuilder = apply(url)
/** Implicitly convert a [[scala.xml.Elem]] into a [[scala.sys.process.ProcessBuilder]] */
+ /*@XML*/
implicit def xmlToProcess(command: scala.xml.Elem): ProcessBuilder = apply(command)
+ /*XML@*/
/** Implicitly convert a `String` into a [[scala.sys.process.ProcessBuilder]] */
implicit def stringToProcess(command: String): ProcessBuilder = apply(command)
diff --git a/src/library/scala/xml/package.scala b/src/library/scala/xml/package.scala
index dec05abd2a..901334ba58 100644
--- a/src/library/scala/xml/package.scala
+++ b/src/library/scala/xml/package.scala
@@ -1,3 +1,11 @@
+/* __ *\
+** ________ ___ / / ___ Scala API **
+** / __/ __// _ | / / / _ | (c) 2003-2011, LAMP/EPFL **
+** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
+** /____/\___/_/ |_/____/_/ | | **
+** |/ **
+\* */
+
package scala
package object xml {
@@ -8,4 +16,4 @@ package object xml {
type EntityResolver = org.xml.sax.EntityResolver
type InputSource = org.xml.sax.InputSource
type SAXParser = javax.xml.parsers.SAXParser
-} \ No newline at end of file
+}