aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/parsing/Parsers.scala
diff options
context:
space:
mode:
authorFelix Mulder <felix.mulder@gmail.com>2016-11-17 10:08:49 +0100
committerGitHub <noreply@github.com>2016-11-17 10:08:49 +0100
commita0169b7eda8bf68b17c59701838017099f31d239 (patch)
treef2a4e1f11cf58665e6d2927376392cf33fb61d68 /src/dotty/tools/dotc/parsing/Parsers.scala
parent528bccf9de97dd83418780bf26b3e797dde59875 (diff)
parenta2354dd7e347a191c6077105b136d683013dd092 (diff)
downloaddotty-a0169b7eda8bf68b17c59701838017099f31d239.tar.gz
dotty-a0169b7eda8bf68b17c59701838017099f31d239.tar.bz2
dotty-a0169b7eda8bf68b17c59701838017099f31d239.zip
Merge pull request #1696 from felixmulder/topic/assert-message-laziness
Make sure messages are lazily evaluated until `report` in `Reporter`
Diffstat (limited to 'src/dotty/tools/dotc/parsing/Parsers.scala')
-rw-r--r--src/dotty/tools/dotc/parsing/Parsers.scala14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/parsing/Parsers.scala b/src/dotty/tools/dotc/parsing/Parsers.scala
index 3fb6de262..bb76de6cc 100644
--- a/src/dotty/tools/dotc/parsing/Parsers.scala
+++ b/src/dotty/tools/dotc/parsing/Parsers.scala
@@ -99,7 +99,7 @@ object Parsers {
/** Issue an error at given offset if beyond last error offset
* and update lastErrorOffset.
*/
- def syntaxError(msg: Message, offset: Int = in.offset): Unit =
+ def syntaxError(msg: => Message, offset: Int = in.offset): Unit =
if (offset > lastErrorOffset) {
syntaxError(msg, Position(offset))
lastErrorOffset = in.offset
@@ -108,7 +108,7 @@ object Parsers {
/** Unconditionally issue an error at given position, without
* updating lastErrorOffset.
*/
- def syntaxError(msg: Message, pos: Position): Unit =
+ def syntaxError(msg: => Message, pos: Position): Unit =
ctx.error(msg, source atPos pos)
}
@@ -215,23 +215,23 @@ object Parsers {
}
}
- def warning(msg: Message, sourcePos: SourcePosition) =
+ def warning(msg: => Message, sourcePos: SourcePosition) =
ctx.warning(msg, sourcePos)
- def warning(msg: Message, offset: Int = in.offset) =
+ def warning(msg: => Message, offset: Int = in.offset) =
ctx.warning(msg, source atPos Position(offset))
- def deprecationWarning(msg: Message, offset: Int = in.offset) =
+ def deprecationWarning(msg: => Message, offset: Int = in.offset) =
ctx.deprecationWarning(msg, source atPos Position(offset))
/** Issue an error at current offset taht input is incomplete */
- def incompleteInputError(msg: Message) =
+ def incompleteInputError(msg: => Message) =
ctx.incompleteInputError(msg, source atPos Position(in.offset))
/** If at end of file, issue an incompleteInputError.
* Otherwise issue a syntax error and skip to next safe point.
*/
- def syntaxErrorOrIncomplete(msg: Message) =
+ def syntaxErrorOrIncomplete(msg: => Message) =
if (in.token == EOF) incompleteInputError(msg)
else {
syntaxError(msg)