summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2013-07-27 22:10:15 -0700
committerGrzegorz Kossakowski <grzegorz.kossakowski@gmail.com>2013-07-27 22:10:15 -0700
commitc0672697c6c21b9c7cc7d70104aee51228617910 (patch)
treed2b3f70fb66b792b904169b4f0d6c6698a97838c
parentdd020009ff09ef49443ba585052021763b9e1579 (diff)
parent0a3f340042e77b171783d97a8029ebf8e1974eb0 (diff)
downloadscala-c0672697c6c21b9c7cc7d70104aee51228617910.tar.gz
scala-c0672697c6c21b9c7cc7d70104aee51228617910.tar.bz2
scala-c0672697c6c21b9c7cc7d70104aee51228617910.zip
Merge pull request #2758 from soc/SI-7681-dead-code-phases
SI-7681 Remove Phases, clean up TableDef
-rw-r--r--src/compiler/scala/tools/nsc/Phases.scala43
-rw-r--r--src/compiler/scala/tools/nsc/util/package.scala6
-rw-r--r--src/reflect/scala/reflect/internal/util/TableDef.scala19
3 files changed, 8 insertions, 60 deletions
diff --git a/src/compiler/scala/tools/nsc/Phases.scala b/src/compiler/scala/tools/nsc/Phases.scala
deleted file mode 100644
index e379afce9b..0000000000
--- a/src/compiler/scala/tools/nsc/Phases.scala
+++ /dev/null
@@ -1,43 +0,0 @@
-/* NSC -- new Scala compiler
- * Copyright 2005-2013 LAMP/EPFL
- * @author Martin Odersky
- */
-
-package scala.tools.nsc
-
-import scala.reflect.internal.util.TableDef
-import scala.language.postfixOps
-
-@deprecated("Scheduled for removal as being a dead-code in the compiler.", "2.10.1")
-object Phases {
- val MaxPhases = 64
-
- /** A class for tracking something about each phase.
- */
- class Model[T] {
- case class Cell(ph: Phase, value: T) {
- def name = ph.name
- def id = ph.id
- }
- val values = new Array[Cell](MaxPhases + 1)
- def results = values filterNot (_ == null)
- def update(ph: Phase, value: T): Unit = values(ph.id) = Cell(ph, value)
- }
- /** A class for recording the elapsed time of each phase in the
- * interests of generating a classy and informative table.
- */
- class TimingModel extends Model[Long] {
- var total: Long = 0
- def table() = {
- total = results map (_.value) sum;
- new Format.Table(results sortBy (-_.value))
- }
- object Format extends TableDef[Cell] {
- >> ("phase" -> (_.name)) >+ " "
- << ("id" -> (_.id)) >+ " "
- >> ("ms" -> (_.value)) >+ " "
- << ("share" -> (_.value.toDouble * 100 / total formatted "%.2f"))
- }
- }
-}
-
diff --git a/src/compiler/scala/tools/nsc/util/package.scala b/src/compiler/scala/tools/nsc/util/package.scala
index 1e43d18900..752aac5c8c 100644
--- a/src/compiler/scala/tools/nsc/util/package.scala
+++ b/src/compiler/scala/tools/nsc/util/package.scala
@@ -86,12 +86,6 @@ package object util {
@deprecated("Moved to scala.reflect.internal.util.StringOps", "2.10.0")
type StringOps = scala.reflect.internal.util.StringOps
- @deprecated("Moved to scala.reflect.internal.util.TableDef", "2.10.0")
- val TableDef = scala.reflect.internal.util.TableDef
-
- @deprecated("Moved to scala.reflect.internal.util.TableDef", "2.10.0")
- type TableDef[T] = scala.reflect.internal.util.TableDef[T]
-
@deprecated("scala.reflect.internal.util.WeakHashSet", "2.10.0")
type WeakHashSet[T <: AnyRef] = scala.reflect.internal.util.WeakHashSet[T]
diff --git a/src/reflect/scala/reflect/internal/util/TableDef.scala b/src/reflect/scala/reflect/internal/util/TableDef.scala
index 1626da2c93..e97aa662d8 100644
--- a/src/reflect/scala/reflect/internal/util/TableDef.scala
+++ b/src/reflect/scala/reflect/internal/util/TableDef.scala
@@ -5,27 +5,24 @@ import TableDef._
import scala.language.postfixOps
/** A class for representing tabular data in a way that preserves
- * its inner beauty. See Exceptional for an example usage.
+ * its inner beauty.
* One creates an instance of TableDef by defining the columns of
* the table, then uses that to create an instance of Table by
* passing in a sequence of rows.
*/
class TableDef[T](_cols: Column[T]*) {
- /** These operators are about all there is to it.
- *
- * ~ appends a column to the table
- * >> creates a right-justified column and appends it
- * << creates a left-justified column and appends it
- * >+ specifies a string to separate the previous column from the next.
- * if none is specified, a space is used.
- */
+ // These operators are about all there is to it.
+ /** Appends a column to the table. */
def ~(next: Column[T]) = retThis(cols :+= next)
+ /** Creates a right-justified column and appends it. */
def >>(pair: (String, T => Any)) = this ~ Column(pair._1, pair._2, left = false)
+ /** Creates a left-justified column and appends it. */
def <<(pair: (String, T => Any)) = this ~ Column(pair._1, pair._2, left = true)
+ /** Specifies a string to separate the previous column from the next.
+ * If none is specified, a space is used. */
def >+(sep: String) = retThis(separators += ((cols.size - 1, sep)))
- /** Below this point should all be considered private/internal.
- */
+ // Below this point should all be considered private/internal.
private var cols: List[Column[T]] = _cols.toList
private var separators: Map[Int, String] = Map()