diff options
author | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-02-13 11:54:10 +0100 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@epfl.ch> | 2012-02-17 14:19:02 +0100 |
commit | a57ac60dbb115b90ca1ccc9944199bf3e82d517d (patch) | |
tree | 680f66ee9f6970e16d2d0ff89759d58010acc6bd /src/compiler/scala/tools/nsc/typechecker/Typers.scala | |
parent | 5efc2df71a517b0cb7d0abc828a580936befe5aa (diff) | |
download | scala-a57ac60dbb115b90ca1ccc9944199bf3e82d517d.tar.gz scala-a57ac60dbb115b90ca1ccc9944199bf3e82d517d.tar.bz2 scala-a57ac60dbb115b90ca1ccc9944199bf3e82d517d.zip |
[vpm] working type switch for try/catch
catch handlers are now also translated by the virtualizing pattern matcher
emit type-based switches when possible, fallback to catch-all with full pattern match
(the logic used to emit constant-based switches was generalized to type-based switches,
abstracting out how to refer to the scrutinee and the shape of a default/catch-all case)
this was the last missing piece of essential functionality
now the virtualizing pattern matcher and the old one are mutually exclusive:
-Yvirtpatmat disables the old matcher logic completely
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Typers.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 5411ea1788..23fc30b9fb 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -4250,6 +4250,11 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { block1 = adapt(block1, mode, owntype) catches1 = catches1 map (adaptCase(_, owntype)) } + + if(!isPastTyper && opt.virtPatmat) { + catches1 = (MatchTranslator(this)).translateTry(catches1, owntype, tree.pos) + } + treeCopy.Try(tree, block1, catches1, finalizer1) setType owntype case Throw(expr) => |