aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2015-06-25 12:51:58 +0200
committerMartin Odersky <odersky@gmail.com>2015-06-25 12:52:04 +0200
commit9e77285fc4487330da1bc2ed210dadda92de9303 (patch)
treee8ffe250f79c411aa0a200fa3c398a94414d82ac /src/dotty/tools
parentde1042ac04085b496b006c6567d8e737ca5d8ee7 (diff)
downloaddotty-9e77285fc4487330da1bc2ed210dadda92de9303.tar.gz
dotty-9e77285fc4487330da1bc2ed210dadda92de9303.tar.bz2
dotty-9e77285fc4487330da1bc2ed210dadda92de9303.zip
Document that lines and columns start at 0.
And adjust for it in DottyBackendInterface
Diffstat (limited to 'src/dotty/tools')
-rw-r--r--src/dotty/tools/backend/jvm/DottyBackendInterface.scala2
-rw-r--r--src/dotty/tools/dotc/util/SourcePosition.scala4
2 files changed, 5 insertions, 1 deletions
diff --git a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala
index 855147ac4..d7a5c7be0 100644
--- a/src/dotty/tools/backend/jvm/DottyBackendInterface.scala
+++ b/src/dotty/tools/backend/jvm/DottyBackendInterface.scala
@@ -480,7 +480,7 @@ class DottyBackendInterface()(implicit ctx: Context) extends BackendInterface{
implicit def positionHelper(a: Position): PositionHelper = new PositionHelper {
def isDefined: Boolean = a.exists
- def line: Int = sourcePos(a).line
+ def line: Int = sourcePos(a).line + 1
def finalPosition: Position = a
}
diff --git a/src/dotty/tools/dotc/util/SourcePosition.scala b/src/dotty/tools/dotc/util/SourcePosition.scala
index 3d6352a1a..c88cbc78b 100644
--- a/src/dotty/tools/dotc/util/SourcePosition.scala
+++ b/src/dotty/tools/dotc/util/SourcePosition.scala
@@ -10,7 +10,11 @@ case class SourcePosition(source: SourceFile, pos: Position) {
def exists = pos.exists
def lineContents: String = source.lineContents(point)
+
+ /** The line of the position, starting at 0 */
def line: Int = source.offsetToLine(point)
+
+ /** The column of the position, starting at 0 */
def column: Int = source.column(point)
override def toString =