Implement non-local returns using NonLocalReturnControl exceptions.
Constructors
Members
A hashmap from method symbols to non-local return keys
A hashmap from method symbols to non-local return keys
The type of a non-local return expression with given argument type
The type of a non-local return expression with given argument type
Return non-local return key for given method
Return non-local return key for given method
Generate a non-local return throw with given return expression from given method. I.e. for the method's non-local return key, generate:
throw new NonLoc...
Generate a non-local return throw with given return expression from given method. I.e. for the method's non-local return key, generate:
throw new NonLocalReturnControl(key, expr) todo: maybe clone a pre-existing exception instead? (but what to do about exceptions that miss their targets?)
Transform (body, key) to:
{ val key = new Object() try { body } catch { case ex: NonLocalReturnControl => if (ex.key().eq(key)) ex.value().asInstanceOf[T] else...
Transform (body, key) to:
{ val key = new Object() try { body } catch { case ex: NonLocalReturnControl => if (ex.key().eq(key)) ex.value().asInstanceOf[T] else throw ex } }
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
List of names of phases that should precede this phase
List of names of phases that should precede this phase