summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-04-14 06:16:32 +0100
committerPaul Phillips <paulp@improving.org>2012-04-16 04:14:54 +0100
commit4a6f54b5f16b3179b23a44f2f1d83f080e218f72 (patch)
tree9d68580b78f9da34f4b90a90f1eb10182c4cd6c7 /src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
parent364dd41c3e0e33afe6c3ec6e0c04f1d345c4b6ca (diff)
downloadscala-4a6f54b5f16b3179b23a44f2f1d83f080e218f72.tar.gz
scala-4a6f54b5f16b3179b23a44f2f1d83f080e218f72.tar.bz2
scala-4a6f54b5f16b3179b23a44f2f1d83f080e218f72.zip
New facility: TypeDestructurers.
Would prefer to bake a little longer, but, scala days. More elaboration to come.
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, 8 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
index eb4deeeee2..bca1cc4596 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/Parsers.scala
@@ -317,7 +317,7 @@ self =>
* by compilationUnit().
*/
def scriptBody(): Tree = {
- val stmts = templateStatSeq(false)._2
+ val stmts = templateStats()
accept(EOF)
def mainModuleName = newTermName(settings.script.value)
@@ -2869,6 +2869,13 @@ self =>
stats.toList
}
+ /** Informal - for the repl and other direct parser accessors.
+ */
+ def templateStats(): List[Tree] = templateStatSeq(false)._2 match {
+ case Nil => List(EmptyTree)
+ case stats => stats
+ }
+
/** {{{
* TemplateStatSeq ::= [id [`:' Type] `=>'] TemplateStat {semi TemplateStat}
* TemplateStat ::= Import