summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2012-08-29 12:44:06 +0200
committerIulian Dragos <jaguarul@gmail.com>2012-08-29 18:51:58 +0200
commit32cb44f9136a03e762baba420c0be2f4c27f4354 (patch)
tree0404e5279f519181891fa2bca3e9696c1aa82885 /src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
parente03a5b766be27a1f43c9151a611b04519a2b15df (diff)
downloadscala-32cb44f9136a03e762baba420c0be2f4c27f4354.tar.gz
scala-32cb44f9136a03e762baba420c0be2f4c27f4354.tar.bz2
scala-32cb44f9136a03e762baba420c0be2f4c27f4354.zip
Two fixes for the worksheet instrumenter
(1) Handle empty worksheets (2) Handle for expressions Review by @dragos (cherry picked from commit 20dc9cd7848863097b07d1cb84ae3f729f7e94da)
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/Parsers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala9
1 files changed, 7 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 17bea7f796..e79c92e162 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -1366,7 +1366,8 @@ self =>
}
parseDo
case FOR =>
- def parseFor = atPos(in.skipToken()) {
+ val start = in.skipToken()
+ def parseFor = atPos(start) {
val enums =
if (in.token == LBRACE) inBracesOrNil(enumerators())
else inParensOrNil(enumerators())
@@ -1378,7 +1379,11 @@ self =>
makeFor(enums, expr())
}
}
- parseFor
+ def adjustStart(tree: Tree) =
+ if (tree.pos.isRange && start < tree.pos.start)
+ tree setPos tree.pos.withStart(start)
+ else tree
+ adjustStart(parseFor)
case RETURN =>
def parseReturn =
atPos(in.skipToken()) {