class TryCatchPatterns
extends MiniPhaseTransform

Compiles the cases that can not be handled by primitive catch cases as a common pattern match.

The following code:

try { <code> }
catch {
  <tryCases> // Cases that can be handled by catch
  <patternMatchCases> // Cases starting with first one that can't be handled by catch
}

will become:

try { <code> }
catch {
  <tryCases>
  case e => e match {
    <patternMatchCases>
  }
}

Cases that are not supported include: - Applies and unapplies - Idents - Alternatives - case _: T => where T is not Throwable

Constructors

TryCatchPatterns ( )

Members

override def checkPostCondition ( tree: Tree ) ( implicit ctx: Context ) : Unit

Check what the phase achieves, to be called at any point after it is finished.

Check what the phase achieves, to be called at any point after it is finished.

private def isCatchCase ( cdef: CaseDef ) ( implicit ctx: Context ) : Boolean

Is this pattern node a catch-all or type-test pattern?

Is this pattern node a catch-all or type-test pattern?

private def isSimpleThrowable ( tp: Type ) ( implicit ctx: Context ) : Boolean
private def mkFallbackPatterMatchCase ( patternMatchCases: List [ CaseDef ] , pos: Position ) ( implicit ctx: Context , info: TransformerInfo ) : Option [ CaseDef ]
[+] def phaseName : String

A name given to the Phase that can be used to debug the compiler. For instance, it is possible to print trees after a given phase using:

A name given to the Phase that can be used to debug the compiler. For instance, it is possible to print trees after a given phase using:

$ ./bin/dotc -Xprint:<phaseNameHere> sourceFile.scala
override def runsAfter : Set [ Class [ Nothing <: Phase ] ]

List of names of phases that should precede this phase

List of names of phases that should precede this phase

override def transformTry ( tree: Try ) ( implicit ctx: Context , info: TransformerInfo ) : Tree