diff options
author | Martin Odersky <odersky@gmail.com> | 2015-06-25 12:51:58 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2015-06-25 12:52:04 +0200 |
commit | 9e77285fc4487330da1bc2ed210dadda92de9303 (patch) | |
tree | e8ffe250f79c411aa0a200fa3c398a94414d82ac /src/dotty/tools/dotc/util/SourcePosition.scala | |
parent | de1042ac04085b496b006c6567d8e737ca5d8ee7 (diff) | |
download | dotty-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/dotc/util/SourcePosition.scala')
-rw-r--r-- | src/dotty/tools/dotc/util/SourcePosition.scala | 4 |
1 files changed, 4 insertions, 0 deletions
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 = |