diff options
Diffstat (limited to 'scalatexApi/src/main/scala')
-rw-r--r-- | scalatexApi/src/main/scala/scalatex/stages/Compiler.scala | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/scalatexApi/src/main/scala/scalatex/stages/Compiler.scala b/scalatexApi/src/main/scala/scalatex/stages/Compiler.scala index f30ee57..84c1c09 100644 --- a/scalatexApi/src/main/scala/scalatex/stages/Compiler.scala +++ b/scalatexApi/src/main/scala/scalatex/stages/Compiler.scala @@ -18,7 +18,7 @@ object Compiler{ def posFor(offset: Int) = { new OffsetPosition( literalPos.source, - offset + math.min(offset, literalPos.source.length - 1) ).asInstanceOf[c.universe.Position] } def compileTree(frag: WN.TemplateTree): Tree = { @@ -27,16 +27,20 @@ object Compiler{ object fragPos{ private val fragPos = posFor(literalPos.point + frag.offset) private def fragPosFor(offset: Int) = { - println(posFor(fragPos.point + offset)) - posFor(fragPos.point + offset) + val res = posFor(fragPos.point + offset) + println(res.lineContent) + res } def at(t: Tree, offset: Int) = { println(t) - atPos(fragPosFor(offset))(t) + val res = atPos(fragPosFor(offset))(t) + println("-") + res } def set(t: Tree, offset: Int) = { println(t) c.internal.setPos(t, fragPosFor(offset)) + println("+") t } } |