summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2008-02-10 11:24:46 +0000
committerMartin Odersky <odersky@gmail.com>2008-02-10 11:24:46 +0000
commit613ee6e29962b872f7677cce97a27673a0a61e95 (patch)
tree80fa9e7d93e94e3eaadf9d051fff309d77b73672 /src
parentd3a71dbd88dd98006a893b35d52ad909c8cd10bb (diff)
downloadscala-613ee6e29962b872f7677cce97a27673a0a61e95.tar.gz
scala-613ee6e29962b872f7677cce97a27673a0a61e95.tar.bz2
scala-613ee6e29962b872f7677cce97a27673a0a61e95.zip
Changed translation for pattern definitions whi...
Changed translation for pattern definitions which bind zero variables so that they work in the interpreter.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/Interpreter.scala4
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala7
2 files changed, 3 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/Interpreter.scala b/src/compiler/scala/tools/nsc/Interpreter.scala
index d12813626e..be954205f2 100644
--- a/src/compiler/scala/tools/nsc/Interpreter.scala
+++ b/src/compiler/scala/tools/nsc/Interpreter.scala
@@ -663,7 +663,7 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
/** generate the source code for the object that computes this request */
def objectSourceCode: String =
- stringFrom(code => {
+ stringFrom { code =>
// header for the wrapper object
code.println("object " + objectName + " {")
@@ -681,7 +681,7 @@ class Interpreter(val settings: Settings, out: PrintWriter) {
//end the wrapper object
code.println(";}")
- })
+ }
/** Types of variables defined by this request. They are computed
after compilation of the main object */
diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
index 240c2519d2..6606d30a84 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
@@ -396,13 +396,10 @@ abstract class TreeBuilder {
List(ValDef(mods, name, tpt, rhs).setPos(pat.pos))
case None =>
- // in case there are no variables in pattern
- // val/var p = e ==> e.match (case p => ())
- //
// in case there is exactly one variable x_1 in pattern
// val/var p = e ==> val/var x_1 = e.match (case p => (x_1))
//
- // in case there are more variables in pattern
+ // in case there are zero or more than one variables in pattern
// val/var p = e ==> private synthetic val t$ = e.match (case p => (x_1, ..., x_N))
// val/var x_1 = t$._1
// ...
@@ -415,8 +412,6 @@ abstract class TreeBuilder {
List(CaseDef(pat1, EmptyTree, makeTupleTerm(vars map (_._1) map Ident, true))))
}
vars match {
- case List() =>
- List(matchExpr)
case List((vname, tpt, pos)) =>
List(ValDef(mods, vname, tpt, matchExpr).setPos(pos))
case _ =>