summaryrefslogtreecommitdiff
path: root/src/reflect
diff options
context:
space:
mode:
authorJames Iry <jamesiry@gmail.com>2013-01-30 15:46:40 -0800
committerJames Iry <jamesiry@gmail.com>2013-01-30 16:14:13 -0800
commit80a814d82cd85a63ec1df516dc18559661f67559 (patch)
tree6296502a3b4a08983c112e6b928abc4f94488003 /src/reflect
parent74b3e9aefe05363a14c217b558d8f9890c008379 (diff)
downloadscala-80a814d82cd85a63ec1df516dc18559661f67559.tar.gz
scala-80a814d82cd85a63ec1df516dc18559661f67559.tar.bz2
scala-80a814d82cd85a63ec1df516dc18559661f67559.zip
SI-6728 Fixes crash in parser on incomplete for expression
The parser was trying to take the position of an empty expression which would crash. Son on the empty expression case in TreeBuilder# makeWhile it tries to do that and, if that failed, gets a position that wraps both the condition and the body. I also made a slight improvement to the UnsupportedOperationEx messages in Position.
Diffstat (limited to 'src/reflect')
-rw-r--r--src/reflect/scala/reflect/internal/util/Position.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/reflect/scala/reflect/internal/util/Position.scala b/src/reflect/scala/reflect/internal/util/Position.scala
index 3d10d4c9ce..8f287a1640 100644
--- a/src/reflect/scala/reflect/internal/util/Position.scala
+++ b/src/reflect/scala/reflect/internal/util/Position.scala
@@ -91,7 +91,7 @@ abstract class Position extends scala.reflect.api.Position { self =>
/** An optional value containing the source file referred to by this position, or
* None if not defined.
*/
- def source: SourceFile = throw new UnsupportedOperationException("Position.source")
+ def source: SourceFile = throw new UnsupportedOperationException(s"Position.source on ${this.getClass}")
/** Is this position neither a NoPosition nor a FakePosition?
* If isDefined is true, offset and source are both defined.
@@ -111,19 +111,19 @@ abstract class Position extends scala.reflect.api.Position { self =>
def makeTransparent: Position = this
/** The start of the position's range, error if not a range position */
- def start: Int = throw new UnsupportedOperationException("Position.start")
+ def start: Int = throw new UnsupportedOperationException(s"Position.start on ${this.getClass}")
/** The start of the position's range, or point if not a range position */
def startOrPoint: Int = point
/** The point (where the ^ is) of the position */
- def point: Int = throw new UnsupportedOperationException("Position.point")
+ def point: Int = throw new UnsupportedOperationException(s"Position.point on ${this.getClass}")
/** The point (where the ^ is) of the position, or else `default` if undefined */
def pointOrElse(default: Int): Int = default
/** The end of the position's range, error if not a range position */
- def end: Int = throw new UnsupportedOperationException("Position.end")
+ def end: Int = throw new UnsupportedOperationException(s"Position.end on ${this.getClass}")
/** The end of the position's range, or point if not a range position */
def endOrPoint: Int = point