Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Have checkpoint report (and clear) non-fatal errors. #376

Merged
merged 5 commits into from
Jan 27, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions chiselFrontend/src/main/scala/chisel3/internal/Error.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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] = {
Expand Down