diff options
author | Miles Sabin <miles@milessabin.com> | 2009-08-25 17:28:33 +0000 |
---|---|---|
committer | Miles Sabin <miles@milessabin.com> | 2009-08-25 17:28:33 +0000 |
commit | 7224d1c26def0519cab9c31c77f02f0ab5734838 (patch) | |
tree | ea69bc7b8696ca5dbe16b621367a2b0f1ee58d3d /src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | |
parent | ac290525356e1db8408e4c6b2034103805783dec (diff) | |
download | scala-7224d1c26def0519cab9c31c77f02f0ab5734838.tar.gz scala-7224d1c26def0519cab9c31c77f02f0ab5734838.tar.bz2 scala-7224d1c26def0519cab9c31c77f02f0ab5734838.zip |
Fix for #2275 with tests.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/Parsers.scala')
-rwxr-xr-x | src/compiler/scala/tools/nsc/ast/parser/Parsers.scala | 12 |
1 files changed, 10 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 4fad4d7bce..bad78123ca 100755 --- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala +++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala @@ -539,7 +539,7 @@ self => leftAssoc && prec == precedence(opstack.head.operator))) { val opinfo = opstack.head opstack = opstack.tail - val opPos = rangePos(opinfo.operand.pos.source, opinfo.offset, opinfo.offset, opinfo.offset+opinfo.operator.length) + val opPos = r2p(opinfo.offset, opinfo.offset, opinfo.offset+opinfo.operator.length) top = atPos(opinfo.operand.pos.startOrPoint, opinfo.offset) { makeBinop(isExpr, opinfo.operand, opinfo.operator, top, opPos) } @@ -1111,6 +1111,11 @@ self => def postfixExpr(): Tree = { val base = opstack var top = prefixExpr() + // Various errors in XML literals can cause xmlLiteral to propagate + // EmptyTree's. Watch out for them here. + if (top == EmptyTree) + return EmptyTree + while (isIdent) { top = reduceStack(true, base, top, precedence(in.name), treeInfo.isLeftAssoc(in.name)) val op = in.name @@ -1118,7 +1123,10 @@ self => ident() newLineOptWhenFollowing(isExprIntroToken) if (isExprIntro) { - top = prefixExpr() + val next = prefixExpr() + if (next == EmptyTree) + return reduceStack(true, base, top, 0, true) + top = next } else { val topinfo = opstack.head opstack = opstack.tail |