diff options
author | Paul Phillips <paulp@improving.org> | 2012-11-13 00:14:40 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-11-19 11:55:06 -0800 |
commit | d5e3f85946af966111f88af90a666a709df0ba6f (patch) | |
tree | edb2d3cfae76679bc0311f3c22d01779a2f32ef3 /src/compiler/scala/tools/nsc/io | |
parent | 645c2676dd6699ac24a57dfe750386bbdb827ee8 (diff) | |
download | scala-d5e3f85946af966111f88af90a666a709df0ba6f.tar.gz scala-d5e3f85946af966111f88af90a666a709df0ba6f.tar.bz2 scala-d5e3f85946af966111f88af90a666a709df0ba6f.zip |
Revert "Commenting out unused members."
This reverts commit 951fc3a486.
Diffstat (limited to 'src/compiler/scala/tools/nsc/io')
-rw-r--r-- | src/compiler/scala/tools/nsc/io/Fileish.scala | 52 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/io/Jar.scala | 24 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/io/MsilFile.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/io/Pickler.scala | 74 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/io/Socket.scala | 8 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/io/SourceReader.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/io/package.scala | 22 |
7 files changed, 92 insertions, 92 deletions
diff --git a/src/compiler/scala/tools/nsc/io/Fileish.scala b/src/compiler/scala/tools/nsc/io/Fileish.scala index 77d12ea022..7b4e385dd8 100644 --- a/src/compiler/scala/tools/nsc/io/Fileish.scala +++ b/src/compiler/scala/tools/nsc/io/Fileish.scala @@ -1,33 +1,33 @@ -// /* NSC -- new Scala compiler -// * Copyright 2005-2013 LAMP/EPFL -// * @author Paul Phillips -// */ +/* NSC -- new Scala compiler + * Copyright 2005-2013 LAMP/EPFL + * @author Paul Phillips + */ -// package scala.tools.nsc -// package io +package scala.tools.nsc +package io -// import java.io.{ InputStream } -// import java.util.jar.JarEntry +import java.io.{ InputStream } +import java.util.jar.JarEntry -// /** A common interface for File-based things and Stream-based things. -// * (In particular, io.File and JarEntry.) -// */ -// class Fileish(val path: Path, val input: () => InputStream) extends Streamable.Chars { -// def inputStream() = input() +/** A common interface for File-based things and Stream-based things. + * (In particular, io.File and JarEntry.) + */ +class Fileish(val path: Path, val input: () => InputStream) extends Streamable.Chars { + def inputStream() = input() -// def parent = path.parent -// def name = path.name -// def isSourceFile = path.hasExtension("java", "scala") + def parent = path.parent + def name = path.name + def isSourceFile = path.hasExtension("java", "scala") -// private lazy val pkgLines = lines() collect { case x if x startsWith "package " => x stripPrefix "package" trim } -// lazy val pkgFromPath = parent.path.replaceAll("""[/\\]""", ".") -// lazy val pkgFromSource = pkgLines map (_ stripSuffix ";") mkString "." + private lazy val pkgLines = lines() collect { case x if x startsWith "package " => x stripPrefix "package" trim } + lazy val pkgFromPath = parent.path.replaceAll("""[/\\]""", ".") + lazy val pkgFromSource = pkgLines map (_ stripSuffix ";") mkString "." -// override def toString = path.path -// } + override def toString = path.path +} -// object Fileish { -// def apply(f: File): Fileish = new Fileish(f, () => f.inputStream()) -// def apply(f: JarEntry, in: () => InputStream): Fileish = new Fileish(Path(f.getName), in) -// def apply(path: String, in: () => InputStream): Fileish = new Fileish(Path(path), in) -// } +object Fileish { + def apply(f: File): Fileish = new Fileish(f, () => f.inputStream()) + def apply(f: JarEntry, in: () => InputStream): Fileish = new Fileish(Path(f.getName), in) + def apply(path: String, in: () => InputStream): Fileish = new Fileish(Path(path), in) +} diff --git a/src/compiler/scala/tools/nsc/io/Jar.scala b/src/compiler/scala/tools/nsc/io/Jar.scala index 6f1c322391..ef2c9b13c0 100644 --- a/src/compiler/scala/tools/nsc/io/Jar.scala +++ b/src/compiler/scala/tools/nsc/io/Jar.scala @@ -36,9 +36,9 @@ class Jar(file: File) extends Iterable[JarEntry] { def this(jfile: JFile) = this(File(jfile)) def this(path: String) = this(File(path)) - // protected def errorFn(msg: String): Unit = Console println msg + protected def errorFn(msg: String): Unit = Console println msg - // lazy val jarFile = new JarFile(file.jfile) + lazy val jarFile = new JarFile(file.jfile) lazy val manifest = withJarInput(s => Option(s.getManifest)) def mainClass = manifest map (f => f(Name.MAIN_CLASS)) @@ -63,12 +63,12 @@ class Jar(file: File) extends Iterable[JarEntry] { Iterator continually in.getNextJarEntry() takeWhile (_ != null) foreach f } override def iterator: Iterator[JarEntry] = this.toList.iterator - // def fileishIterator: Iterator[Fileish] = jarFile.entries.asScala map (x => Fileish(x, () => getEntryStream(x))) + def fileishIterator: Iterator[Fileish] = jarFile.entries.asScala map (x => Fileish(x, () => getEntryStream(x))) - // private def getEntryStream(entry: JarEntry) = jarFile getInputStream entry match { - // case null => errorFn("No such entry: " + entry) ; null - // case x => x - // } + private def getEntryStream(entry: JarEntry) = jarFile getInputStream entry match { + case null => errorFn("No such entry: " + entry) ; null + case x => x + } override def toString = "" + file } @@ -130,7 +130,7 @@ object Jar { m } def apply(manifest: JManifest): WManifest = new WManifest(manifest) - // implicit def unenrichManifest(x: WManifest): JManifest = x.underlying + implicit def unenrichManifest(x: WManifest): JManifest = x.underlying } class WManifest(manifest: JManifest) { for ((k, v) <- initialMainAttrs) @@ -147,12 +147,12 @@ object Jar { } def apply(name: Attributes.Name): String = attrs(name) - // def apply(name: String): String = apply(new Attributes.Name(name)) + def apply(name: String): String = apply(new Attributes.Name(name)) def update(key: Attributes.Name, value: String) = attrs.put(key, value) - // def update(key: String, value: String) = attrs.put(new Attributes.Name(key), value) + def update(key: String, value: String) = attrs.put(new Attributes.Name(key), value) - // def mainClass: String = apply(Name.MAIN_CLASS) - // def mainClass_=(value: String) = update(Name.MAIN_CLASS, value) + def mainClass: String = apply(Name.MAIN_CLASS) + def mainClass_=(value: String) = update(Name.MAIN_CLASS, value) } // See http://download.java.net/jdk7/docs/api/java/nio/file/Path.html diff --git a/src/compiler/scala/tools/nsc/io/MsilFile.scala b/src/compiler/scala/tools/nsc/io/MsilFile.scala index 881af2e87a..1a3a4f5c81 100644 --- a/src/compiler/scala/tools/nsc/io/MsilFile.scala +++ b/src/compiler/scala/tools/nsc/io/MsilFile.scala @@ -15,4 +15,4 @@ import ch.epfl.lamp.compiler.msil.{ Type => MsilType } class MsilFile(val msilType: MsilType) extends VirtualFile(msilType.FullName, msilType.Namespace) { } -// object NoMsilFile extends MsilFile(null) { } +object NoMsilFile extends MsilFile(null) { } diff --git a/src/compiler/scala/tools/nsc/io/Pickler.scala b/src/compiler/scala/tools/nsc/io/Pickler.scala index 3f16784b2d..56ff4a57ee 100644 --- a/src/compiler/scala/tools/nsc/io/Pickler.scala +++ b/src/compiler/scala/tools/nsc/io/Pickler.scala @@ -76,7 +76,7 @@ abstract class Pickler[T] { * @param fromNull an implicit evidence parameter ensuring that the type of values * handled by this pickler contains `null`. */ - // def orNull(implicit fromNull: Null <:< T): Pickler[T] = nullablePickler(this) + def orNull(implicit fromNull: Null <:< T): Pickler[T] = nullablePickler(this) /** A conditional pickler obtained from the current pickler. * @param cond the condition to test to find out whether pickler can handle @@ -93,7 +93,7 @@ abstract class Pickler[T] { object Pickler { - // var picklerDebugMode = false + var picklerDebugMode = false /** A base class representing unpickler result. It has two subclasses: * `UnpickleSucess` for successful unpicklings and `UnpickleFailure` for failures, @@ -176,14 +176,14 @@ object Pickler { /** A converter from binary functions to functions over `~`-pairs */ - // implicit def fromTilde[T1, T2, R](f: (T1, T2) => R): T1 ~ T2 => R = { case x1 ~ x2 => f(x1, x2) } + implicit def fromTilde[T1, T2, R](f: (T1, T2) => R): T1 ~ T2 => R = { case x1 ~ x2 => f(x1, x2) } /** An converter from unctions returning Options over pair to functions returning `~`-pairs * The converted function will raise a `MatchError` where the original function returned * a `None`. This converter is useful for turning `unapply` methods of case classes * into wrapper methods that can be passed as second argument to `wrap`. */ - // implicit def toTilde[T1, T2, S](f: S => Option[(T1, T2)]): S => T1 ~ T2 = { x => (f(x): @unchecked) match { case Some((x1, x2)) => x1 ~ x2 } } + implicit def toTilde[T1, T2, S](f: S => Option[(T1, T2)]): S => T1 ~ T2 = { x => (f(x): @unchecked) match { case Some((x1, x2)) => x1 ~ x2 } } /** Same as `p.labelled(label)`. */ @@ -250,13 +250,13 @@ object Pickler { /** Same as `p.orNull` */ - // def nullablePickler[T](p: Pickler[T])(implicit fromNull: Null <:< T): Pickler[T] = new Pickler[T] { - // def pickle(wr: Writer, x: T) = - // if (x == null) wr.write("null") else p.pickle(wr, x) - // def unpickle(rd: Lexer): Unpickled[T] = - // if (rd.token == NullLit) nextSuccess(rd, fromNull(null)) - // else p.unpickle(rd) - // } + def nullablePickler[T](p: Pickler[T])(implicit fromNull: Null <:< T): Pickler[T] = new Pickler[T] { + def pickle(wr: Writer, x: T) = + if (x == null) wr.write("null") else p.pickle(wr, x) + def unpickle(rd: Lexer): Unpickled[T] = + if (rd.token == NullLit) nextSuccess(rd, fromNull(null)) + else p.unpickle(rd) + } /** A conditional pickler for singleton objects. It represents these * with the object's underlying class as a label. @@ -330,20 +330,20 @@ object Pickler { tokenPickler("integer literal") { case IntLit(s) => s.toLong } /** A pickler for values of type `Double`, represented as floating point literals */ - // implicit val doublePickler: Pickler[Double] = - // tokenPickler("floating point literal") { case FloatLit(s) => s.toDouble } + implicit val doublePickler: Pickler[Double] = + tokenPickler("floating point literal") { case FloatLit(s) => s.toDouble } /** A pickler for values of type `Byte`, represented as integer literals */ - // implicit val bytePickler: Pickler[Byte] = longPickler.wrapped { _.toByte } { _.toLong } + implicit val bytePickler: Pickler[Byte] = longPickler.wrapped { _.toByte } { _.toLong } /** A pickler for values of type `Short`, represented as integer literals */ - // implicit val shortPickler: Pickler[Short] = longPickler.wrapped { _.toShort } { _.toLong } + implicit val shortPickler: Pickler[Short] = longPickler.wrapped { _.toShort } { _.toLong } /** A pickler for values of type `Int`, represented as integer literals */ implicit val intPickler: Pickler[Int] = longPickler.wrapped { _.toInt } { _.toLong } /** A pickler for values of type `Float`, represented as floating point literals */ - // implicit val floatPickler: Pickler[Float] = doublePickler.wrapped { _.toFloat } { _.toLong } + implicit val floatPickler: Pickler[Float] = doublePickler.wrapped { _.toFloat } { _.toLong } /** A conditional pickler for the boolean value `true` */ private val truePickler = @@ -373,15 +373,15 @@ object Pickler { } /** A pickler for values of type `Char`, represented as string literals of length 1 */ - // implicit val charPickler: Pickler[Char] = - // stringPickler - // .wrapped { s => require(s.length == 1, "single character string literal expected, but "+quoted(s)+" found"); s(0) } { _.toString } + implicit val charPickler: Pickler[Char] = + stringPickler + .wrapped { s => require(s.length == 1, "single character string literal expected, but "+quoted(s)+" found"); s(0) } { _.toString } /** A pickler for pairs, represented as `~`-pairs */ - // implicit def tuple2Pickler[T1: Pickler, T2: Pickler]: Pickler[(T1, T2)] = - // (pkl[T1] ~ pkl[T2]) - // .wrapped { case x1 ~ x2 => (x1, x2) } { case (x1, x2) => x1 ~ x2 } - // .labelled ("tuple2") + implicit def tuple2Pickler[T1: Pickler, T2: Pickler]: Pickler[(T1, T2)] = + (pkl[T1] ~ pkl[T2]) + .wrapped { case x1 ~ x2 => (x1, x2) } { case (x1, x2) => x1 ~ x2 } + .labelled ("tuple2") /** A pickler for 3-tuples, represented as `~`-tuples */ implicit def tuple3Pickler[T1, T2, T3](implicit p1: Pickler[T1], p2: Pickler[T2], p3: Pickler[T3]): Pickler[(T1, T2, T3)] = @@ -390,34 +390,34 @@ object Pickler { .labelled ("tuple3") /** A pickler for 4-tuples, represented as `~`-tuples */ - // implicit def tuple4Pickler[T1, T2, T3, T4](implicit p1: Pickler[T1], p2: Pickler[T2], p3: Pickler[T3], p4: Pickler[T4]): Pickler[(T1, T2, T3, T4)] = - // (p1 ~ p2 ~ p3 ~ p4) - // .wrapped { case x1 ~ x2 ~ x3 ~ x4 => (x1, x2, x3, x4) } { case (x1, x2, x3, x4) => x1 ~ x2 ~ x3 ~ x4 } - // .labelled ("tuple4") + implicit def tuple4Pickler[T1, T2, T3, T4](implicit p1: Pickler[T1], p2: Pickler[T2], p3: Pickler[T3], p4: Pickler[T4]): Pickler[(T1, T2, T3, T4)] = + (p1 ~ p2 ~ p3 ~ p4) + .wrapped { case x1 ~ x2 ~ x3 ~ x4 => (x1, x2, x3, x4) } { case (x1, x2, x3, x4) => x1 ~ x2 ~ x3 ~ x4 } + .labelled ("tuple4") /** A conditional pickler for the `scala.None` object */ - // implicit val nonePickler = singletonPickler(None) + implicit val nonePickler = singletonPickler(None) /** A conditional pickler for instances of class `scala.Some` */ - // implicit def somePickler[T: Pickler]: CondPickler[Some[T]] = - // pkl[T] - // .wrapped { Some(_) } { _.get } - // .asClass (classOf[Some[T]]) + implicit def somePickler[T: Pickler]: CondPickler[Some[T]] = + pkl[T] + .wrapped { Some(_) } { _.get } + .asClass (classOf[Some[T]]) /** A pickler for optional values */ - // implicit def optionPickler[T: Pickler]: Pickler[Option[T]] = nonePickler | somePickler[T] + implicit def optionPickler[T: Pickler]: Pickler[Option[T]] = nonePickler | somePickler[T] /** A pickler for list values */ implicit def listPickler[T: Pickler]: Pickler[List[T]] = iterPickler[T] .wrapped { _.toList } { _.iterator } .labelled ("scala.List") /** A pickler for vector values */ - // implicit def vectorPickler[T: Pickler]: Pickler[Vector[T]] = - // iterPickler[T] .wrapped { Vector() ++ _ } { _.iterator } .labelled ("scala.Vector") + implicit def vectorPickler[T: Pickler]: Pickler[Vector[T]] = + iterPickler[T] .wrapped { Vector() ++ _ } { _.iterator } .labelled ("scala.Vector") /** A pickler for array values */ - // implicit def array[T : ClassTag : Pickler]: Pickler[Array[T]] = - // iterPickler[T] .wrapped { _.toArray} { _.iterator } .labelled ("scala.Array") + implicit def array[T : ClassTag : Pickler]: Pickler[Array[T]] = + iterPickler[T] .wrapped { _.toArray} { _.iterator } .labelled ("scala.Array") } /** A subclass of Pickler can indicate whether a particular value can be pickled by instances diff --git a/src/compiler/scala/tools/nsc/io/Socket.scala b/src/compiler/scala/tools/nsc/io/Socket.scala index cb264a671c..e766c1b2fd 100644 --- a/src/compiler/scala/tools/nsc/io/Socket.scala +++ b/src/compiler/scala/tools/nsc/io/Socket.scala @@ -28,13 +28,13 @@ object Socket { private val optHandler = handlerFn[Option[T]](_ => None) private val eitherHandler = handlerFn[Either[Throwable, T]](x => Left(x)) - // def getOrElse[T1 >: T](alt: T1): T1 = opt getOrElse alt + def getOrElse[T1 >: T](alt: T1): T1 = opt getOrElse alt def either: Either[Throwable, T] = try Right(f()) catch eitherHandler def opt: Option[T] = try Some(f()) catch optHandler } - // def newIPv4Server(port: Int = 0) = new Box(() => preferringIPv4(new ServerSocket(0))) - // def newServer(port: Int = 0) = new Box(() => new ServerSocket(0)) + def newIPv4Server(port: Int = 0) = new Box(() => preferringIPv4(new ServerSocket(0))) + def newServer(port: Int = 0) = new Box(() => new ServerSocket(0)) def localhost(port: Int) = apply(InetAddress.getLocalHost(), port) def apply(host: InetAddress, port: Int) = new Box(() => new Socket(new JSocket(host, port))) def apply(host: String, port: Int) = new Box(() => new Socket(new JSocket(host, port))) @@ -62,4 +62,4 @@ class Socket(jsocket: JSocket) extends Streamable.Bytes with Closeable { out.close() } } -} +}
\ No newline at end of file diff --git a/src/compiler/scala/tools/nsc/io/SourceReader.scala b/src/compiler/scala/tools/nsc/io/SourceReader.scala index f6759be5eb..af745eb3e8 100644 --- a/src/compiler/scala/tools/nsc/io/SourceReader.scala +++ b/src/compiler/scala/tools/nsc/io/SourceReader.scala @@ -34,7 +34,7 @@ class SourceReader(decoder: CharsetDecoder, reporter: Reporter) { } /** Reads the file with the specified name. */ - // def read(filename: String): Array[Char]= read(new JFile(filename)) + def read(filename: String): Array[Char]= read(new JFile(filename)) /** Reads the specified file. */ def read(file: JFile): Array[Char] = { diff --git a/src/compiler/scala/tools/nsc/io/package.scala b/src/compiler/scala/tools/nsc/io/package.scala index e9fb8a6d98..c29a7c96df 100644 --- a/src/compiler/scala/tools/nsc/io/package.scala +++ b/src/compiler/scala/tools/nsc/io/package.scala @@ -20,14 +20,14 @@ package object io { type Path = scala.reflect.io.Path val Path = scala.reflect.io.Path type PlainFile = scala.reflect.io.PlainFile - // val PlainFile = scala.reflect.io.PlainFile + val PlainFile = scala.reflect.io.PlainFile val Streamable = scala.reflect.io.Streamable type VirtualDirectory = scala.reflect.io.VirtualDirectory type VirtualFile = scala.reflect.io.VirtualFile - // val ZipArchive = scala.reflect.io.ZipArchive + val ZipArchive = scala.reflect.io.ZipArchive type ZipArchive = scala.reflect.io.ZipArchive - // implicit def postfixOps = scala.language.postfixOps // make all postfix ops in this package compile without warning + implicit def postfixOps = scala.language.postfixOps // make all postfix ops in this package compile without warning type JManifest = java.util.jar.Manifest type JFile = java.io.File @@ -38,10 +38,10 @@ package object io { def runnable(body: => Unit): Runnable = new Runnable { override def run() = body } def callable[T](body: => T): Callable[T] = new Callable[T] { override def call() = body } def spawn[T](body: => T): Future[T] = daemonThreadPool submit callable(body) - // def submit(runnable: Runnable) = daemonThreadPool submit runnable + def submit(runnable: Runnable) = daemonThreadPool submit runnable // Create, start, and return a daemon thread - // def daemonize(body: => Unit): Thread = newThread(_ setDaemon true)(body) + def daemonize(body: => Unit): Thread = newThread(_ setDaemon true)(body) def newThread(f: Thread => Unit)(body: => Unit): Thread = { val thread = new Thread(runnable(body)) f(thread) @@ -50,11 +50,11 @@ package object io { } // Set a timer to execute the given code. - // def timer(seconds: Int)(body: => Unit): Timer = { - // val alarm = new Timer(true) // daemon - // val tt = new TimerTask { def run() = body } + def timer(seconds: Int)(body: => Unit): Timer = { + val alarm = new Timer(true) // daemon + val tt = new TimerTask { def run() = body } - // alarm.schedule(tt, seconds * 1000) - // alarm - // } + alarm.schedule(tt, seconds * 1000) + alarm + } } |