Skip to content

Commit 1ef7f59

Browse files
committed
Add documentation
1 parent 35db4a1 commit 1ef7f59

File tree

1 file changed

+26
-8
lines changed

1 file changed

+26
-8
lines changed

compiler/src/dotty/tools/dotc/ast/Trees.scala

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -677,23 +677,41 @@ object Trees {
677677
override def isType = expansion.isType
678678
}
679679

680-
/** A tree representing a quote `'{ expr }
680+
/** A tree representing a quote `'{ expr }`
681+
* `Quote`s are created by the `Parser` with an empty `tpt`. In typer
682+
* they can be typed as a `Quote` with a known `tpt` or desugared and
683+
* typed as a quote pattern.
684+
*
685+
* `Quotes` are checked transformed in the `staging`, `splicing` and `pickleQuotes`
686+
* phases. After `pickleQuotes` phase, the only quotes that exist are in `inline`
687+
* methods. These are dropped when we remove the inline method implementations.
688+
*
689+
* The `tpt` will be transformed in `staging` and used in `pickleQuotes` to create the
690+
* pickled representation of the quote.
681691
*
682692
* @param expr The tree that was quoted
683-
* @param tpt The type of the tree that was quoted,
684-
* EmptyTree if this tree comes from the parser.
693+
* @param tpt The type of the tree that was quoted
685694
*/
686695
case class Quote[+T <: Untyped] private[ast] (expr: Tree[T], tpt: Tree[T])(implicit @constructorOnly src: SourceFile)
687696
extends TermTree[T] {
688697
type ThisTree[+T <: Untyped] = Quote[T]
689698
}
690699

691700
/** A tree representing a splice `${ expr }`
692-
*
693-
* @param expr The tree that was spliced
694-
* @param tpt The type of the tree that was spliced,
695-
* EmptyTree if this tree comes from the parser.
696-
*/
701+
*
702+
* `Splice`s are created by the `Parser` with an empty `tpt`. In typer
703+
* they can be typed as a `Splice` with a known `tpt` or desugared and
704+
* typed as a quote pattern holes.
705+
*
706+
* `Splice` are checked transformed in the `staging` and `splicing` phases.
707+
* After `splicing` phase, the only quotes that exist are in `inline`
708+
* methods. These are dropped when we remove the inline method implementations.
709+
*
710+
* The `tpt` will be transformed in `staging` and used in `splicing` to create `Hole`s.
711+
*
712+
* @param expr The tree that was spliced
713+
* @param tpt The type of the spliced tree
714+
*/
697715
case class Splice[+T <: Untyped] private[ast] (expr: Tree[T], tpt: Tree[T])(implicit @constructorOnly src: SourceFile)
698716
extends TermTree[T] {
699717
type ThisTree[+T <: Untyped] = Splice[T]

0 commit comments

Comments
 (0)