summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2011-01-25 19:46:49 +0000
committerPaul Phillips <paulp@improving.org>2011-01-25 19:46:49 +0000
commit85e79881a01678b53293297e030fd71e83dfa374 (patch)
tree49ef690ca11f3c6ded981f1cde4d099bbaebcd77
parent5f905da8b66fe69b09d8b62c917970cde14e23ba (diff)
downloadscala-85e79881a01678b53293297e030fd71e83dfa374.tar.gz
scala-85e79881a01678b53293297e030fd71e83dfa374.tar.bz2
scala-85e79881a01678b53293297e030fd71e83dfa374.zip
Fixing the positions for catch block expressions.
is right for the situation, but positions are not my strongest thing. I used atPos on the entire new block and marked it with the position of the expression (+ makeTransparent.) If that sounds suboptimal to anyone let me know. Closes #4182, no review.
-rw-r--r--src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
index 14074503e7..d1214d8fe4 100644
--- a/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
+++ b/src/compiler/scala/tools/nsc/ast/parser/TreeBuilder.scala
@@ -492,17 +492,17 @@ abstract class TreeBuilder {
*/
def makeCatchFromExpr(catchExpr: Tree): CaseDef = {
val binder = freshTermName("x")
- val pat = atPos(catchExpr.pos)(Bind(binder, Typed(Ident(nme.WILDCARD), Ident(tpnme.Throwable))))
+ val pat = Bind(binder, Typed(Ident(nme.WILDCARD), Ident(tpnme.Throwable)))
val catchDef = ValDef(NoMods, freshTermName("catchExpr"), TypeTree(), catchExpr)
val catchFn = Ident(catchDef.name)
- val body = Block(
+ val body = atPos(catchExpr.pos.makeTransparent)(Block(
List(catchDef),
If(
Apply(Select(catchFn, nme.isDefinedAt), List(Ident(binder))),
Apply(Select(catchFn, nme.apply), List(Ident(binder))),
Throw(Ident(binder))
)
- )
+ ))
makeCaseDef(pat, EmptyTree, body)
}