summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-05-29 18:41:11 +0000
committerPaul Phillips <paulp@improving.org>2011-05-29 18:41:11 +0000
commit94e1965b645475c3c7bfb3d1e3b4743fb23808d7 (patch)
tree981933e2081b743eb9e81fb62eb2b0d86ef80b01 /src
parentccb438ff74eececcffdb2fc5c4aeafe8a96307d6 (diff)
downloadscala-94e1965b645475c3c7bfb3d1e3b4743fb23808d7.tar.gz
scala-94e1965b645475c3c7bfb3d1e3b4743fb23808d7.tar.bz2
scala-94e1965b645475c3c7bfb3d1e3b4743fb23808d7.zip
Altered the positioning of XML literal trees.
with the earliest position later than the earliest character in the source code, which was breaking some repl logic. No review.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index c7134ce91a..1a0409d440 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -1429,11 +1429,17 @@ self =>
*/
def simpleExpr(): Tree = {
var canApply = true
+ val start = in.offset
val t =
- if (isLiteral) atPos(in.offset)(literal(false))
+ if (isLiteral) atPos(start)(literal(false))
else in.token match {
case XMLSTART =>
- xmlLiteral()
+ // Using setPos here because the generated tree has its position
+ // off by one and I'm not sure where to fix it.
+ // <a></a>
+ // ^--- This was positioned at the a, not the <
+ val lit = xmlLiteral()
+ lit setPos r2p(start, start, in.offset)
case IDENTIFIER | BACKQUOTED_IDENT | THIS | SUPER =>
path(true, false)
case USCORE =>