summaryrefslogtreecommitdiff
path: root/chiselFrontend/src
diff options
context:
space:
mode:
authorJim Lawson2017-01-27 11:35:28 -0800
committerGitHub2017-01-27 11:35:28 -0800
commite77e345ad56aeab823d8aa8fecdd5e27e86b08e2 (patch)
tree9b5741a95a0514b4fdf653ff8d19f156d4d008b5 /chiselFrontend/src
parent295315a5ec83dc3173d6ae2437c11e1d8414f774 (diff)
Have checkpoint report (and clear) non-fatal errors. (#376)
Diffstat (limited to 'chiselFrontend/src')
-rw-r--r--chiselFrontend/src/main/scala/chisel3/internal/Error.scala20
1 files changed, 13 insertions, 7 deletions
diff --git a/chiselFrontend/src/main/scala/chisel3/internal/Error.scala b/chiselFrontend/src/main/scala/chisel3/internal/Error.scala
index c5c67da4..bba7c806 100644
--- a/chiselFrontend/src/main/scala/chisel3/internal/Error.scala
+++ b/chiselFrontend/src/main/scala/chisel3/internal/Error.scala
@@ -37,13 +37,19 @@ private[chisel3] class ErrorLog {
def report(): Unit = errors foreach println // scalastyle:ignore regex
/** Throw an exception if any errors have yet occurred. */
- def checkpoint(): Unit = if(hasErrors) {
- import Console._
- throwException(errors.map(_ + "\n").reduce(_ + _) +
- UNDERLINED + "CODE HAS " + errors.filter(_.isFatal).length + RESET +
- UNDERLINED + " " + RED + "ERRORS" + RESET +
- UNDERLINED + " and " + errors.filterNot(_.isFatal).length + RESET +
- UNDERLINED + " " + YELLOW + "WARNINGS" + RESET)
+ def checkpoint(): Unit = {
+ if(hasErrors) {
+ import Console._
+ throwException(errors.map(_ + "\n").reduce(_ + _) +
+ UNDERLINED + "CODE HAS " + errors.filter(_.isFatal).length + RESET +
+ UNDERLINED + " " + RED + "ERRORS" + RESET +
+ UNDERLINED + " and " + errors.filterNot(_.isFatal).length + RESET +
+ UNDERLINED + " " + YELLOW + "WARNINGS" + RESET)
+ } else {
+ // No fatal errors. Report accumulated warnings and clear them.
+ report()
+ errors.clear()
+ }
}
private def findFirstUserFrame(stack: Array[StackTraceElement]): Option[StackTraceElement] = {