diff options
Diffstat (limited to 'libraries/eval/Eval.scala')
-rw-r--r-- | libraries/eval/Eval.scala | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/libraries/eval/Eval.scala b/libraries/eval/Eval.scala index 33980cf..ed35487 100644 --- a/libraries/eval/Eval.scala +++ b/libraries/eval/Eval.scala @@ -458,7 +458,14 @@ class Eval(target: Option[File]) { case WARNING => "warning: " case _ => "" } - messages += (severityName + "line " + (pos.line - lineOffset) + ": " + message) :: + // the line number is not always available + val lineMessage = + try { + "line " + (pos.line - lineOffset) + } catch { + case _: Throwable => "" + } + messages += (severityName + lineMessage + ": " + message) :: (if (pos.isDefined) { pos.inUltimateSource(pos.source).lineContent.stripLineEnd :: (" " * (pos.column - 1) + "^") :: |