aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/reporting/StoreReporter.scala
blob: 5b9553509635084666441b88a2d3a8124e92208d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package dotty.tools
package dotc
package reporting

import core.Contexts.Context
import scala.collection.mutable
import core.Positions.Position
import Reporter.Severity.{Value => Severity}

/**
 * This class implements a Reporter that stores all messages
 */
class StoreReporter extends Reporter {

  class Info(val msg: String, val severity: Severity, val pos: Position) {
    override def toString() = "pos: " + pos + " " + msg + " " + severity
  }
  val infos = new mutable.LinkedHashSet[Info]

  protected def report(msg: String, severity: Severity, pos: Position)(implicit ctx: Context): Unit = {
    infos += new Info(msg, severity, pos)
  }

  override def reset() {
    super.reset()
    infos.clear()
  }
}