summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-02-19 16:34:11 +0000
committerMartin Odersky <odersky@gmail.com>2007-02-19 16:34:11 +0000
commit53c115ff4c8a6cf81659e0ac7bb878b32765107a (patch)
tree01c06cfac1acc49c78d6ec578a755a7cd73c0666 /src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
parentf1e1fcc733c025710368cdba5648954ef1057d80 (diff)
downloadscala-53c115ff4c8a6cf81659e0ac7bb878b32765107a.tar.gz
scala-53c115ff4c8a6cf81659e0ac7bb878b32765107a.tar.bz2
scala-53c115ff4c8a6cf81659e0ac7bb878b32765107a.zip
fixed bugs 954/958/957, plus problem with the i...
fixed bugs 954/958/957, plus problem with the interpreter.
Diffstat (limited to 'src/compiler/scala/tools/nsc/ast/parser/Parsers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/Parsers.scala11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index 9affe5be75..e21460633c 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -280,7 +280,6 @@ trait Parsers requires SyntaxAnalyzer {
ValDef(Modifiers(Flags.PARAM), name, tpe, EmptyTree)
case _ =>
syntaxError(tree.pos, "not a legal formal parameter", false)
- throw new Error()
ValDef(Modifiers(Flags.PARAM), nme.ERROR, errorTypeTree, EmptyTree)
}
}
@@ -1044,7 +1043,7 @@ trait Parsers requires SyntaxAnalyzer {
val pos = in.skipToken()
val ts = if (in.token == RPAREN) List() else exprs()
accept(RPAREN)
- t = Parens(ts)
+ t = Parens(ts) setPos pos
case LBRACE =>
t = blockExpr()
canApply = false
@@ -1325,7 +1324,7 @@ trait Parsers requires SyntaxAnalyzer {
val pos = in.skipToken()
val ps = if (in.token == RPAREN) List() else patterns(false)
accept(RPAREN)
- Parens(ps)
+ Parens(ps) setPos pos
case XMLSTART =>
xmlp.xLiteralPattern
case _ =>
@@ -2056,9 +2055,9 @@ trait Parsers requires SyntaxAnalyzer {
*/
def templateBody(): Pair[ValDef, List[Tree]] = {
accept(LBRACE)
- val result = templateStatSeq()
+ val result @ Pair(self, stats) = templateStatSeq()
accept(RBRACE)
- result
+ if (stats.isEmpty) Pair(self, List(EmptyTree)) else result
}
/** Refinement ::= [nl] `{' RefineStat {semi RefineStat} `}'
@@ -2150,7 +2149,7 @@ trait Parsers requires SyntaxAnalyzer {
}
if (in.token != RBRACE && in.token != EOF) acceptStatSep()
}
- Pair(self, if (!stats.hasNext) List(EmptyTree) else stats.toList)
+ Pair(self, stats.toList)
}
/** RefineStatSeq ::= RefineStat {semi RefineStat}