Dotty Documentation

0.11.0-bin-SNAPSHOT

class ReifyQuotes

Translates quoted terms and types to unpickle method calls. Checks that the phase consistency principle (PCP) holds.

Transforms top level quote

'{ ...
   val x1 = ???
   val x2 = ???
   ...
   ~{ ... '{ ... x1 ... x2 ...} ... }
   ...
 }

to

 unpickle(
   [[ // PICKLED TASTY
     ...
     val x1 = ???
     val x2 = ???
     ...
     Hole(0 | x1, x2)
     ...
   ]],
   List(
     (args: Seq[Any]) => {
       val x1$1 = args(0).asInstanceOf[Expr[T]]
       val x2$1 = args(1).asInstanceOf[Expr[T]] // can be asInstanceOf[Type[T]]
       ...
       { ... '{ ... x1$1.unary_~ ... x2$1.unary_~ ...} ... }
     }
   )
 )

and then performs the same transformation on '{ ... x1$1.unary_~ ... x2$1.unary_~ ...}.

For macro definitions we assume that we have a single ~ directly as the RHS. The Splicer is used to check that the RHS will be interpretable (with the Splicer) once inlined.

[-] Constructors

ReifyQuotes ( )

[-] Members

[+] private class LevelInfo
[+] private class Reifier

The main transformer class

[+] private var myMacroClassLoader : ClassLoader

Classloader used for loading macros

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

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

[+] private def macroClassLoader ( implicit ctx: Context ) : ClassLoader
[+] protected def newTransformer ( implicit ctx: Context ) : Transformer
[+] override 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:

$ ./bin/dotc -Xprint:<phaseNameHere> sourceFile.scala
[+] override def run ( implicit ctx: Context ) : Unit