aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/ast/Trees.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-08-08 19:21:47 +0200
committerMartin Odersky <odersky@gmail.com>2013-08-08 19:24:18 +0200
commita326b06088d7eadde03bbcd56883b62fcfd21011 (patch)
treefabc34208e4cd5c6da7600cec46e45244586adc1 /src/dotty/tools/dotc/ast/Trees.scala
parent7f8ce8379296a399d29fdf9ec91210f44460f98f (diff)
downloaddotty-a326b06088d7eadde03bbcd56883b62fcfd21011.tar.gz
dotty-a326b06088d7eadde03bbcd56883b62fcfd21011.tar.bz2
dotty-a326b06088d7eadde03bbcd56883b62fcfd21011.zip
Typing of try and throw statements.
Also issues an error on returns form methods missing a return type.
Diffstat (limited to 'src/dotty/tools/dotc/ast/Trees.scala')
-rw-r--r--src/dotty/tools/dotc/ast/Trees.scala20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/ast/Trees.scala b/src/dotty/tools/dotc/ast/Trees.scala
index fd60a100e..ab1517f9c 100644
--- a/src/dotty/tools/dotc/ast/Trees.scala
+++ b/src/dotty/tools/dotc/ast/Trees.scala
@@ -471,7 +471,25 @@ object Trees {
type ThisTree[-T >: Untyped] = Return[T]
}
- /** try block catch handler finally finalizer */
+ /** try block catch handler finally finalizer
+ *
+ * Note: if the handler is a case block CASES of the form
+ *
+ * { case1 ... caseN }
+ *
+ * the parser returns Match(EmptyTree, CASES). Desugaring and typing this yields a closure
+ * node
+ *
+ * { def $anonfun(x: Throwable) = x match CASES; Closure(Nil, $anonfun) }
+ *
+ * At some later stage when we normalize the try we can revert this to
+ *
+ * Match(EmptyTree, CASES)
+ *
+ * or else if stack is non-empty
+ *
+ * Match(EmptyTree, <case x: Throwable => $anonfun(x)>)
+ */
case class Try[-T >: Untyped] private[ast] (expr: Tree[T], handler: Tree[T], finalizer: Tree[T])
extends TermTree[T] {
type ThisTree[-T >: Untyped] = Try[T]