Skip to content

Commit a679194

Browse files
committed
Add comments to RawQuotes
1 parent b28f9da commit a679194

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

compiler/src/dotty/tools/dotc/interpreter/RawExpr.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ package dotty.tools.dotc.interpreter
22

33
import dotty.tools.dotc.ast.tpd
44

5-
class RawExpr(val tree: tpd.Tree) extends quoted.Expr[Any] with RawQuoted {
6-
override def toString: String = s"RawExpr(${tree.toString})"
7-
}
5+
/** Expression `quoted.Expr[_]` for which its internal representation is its tree. */
6+
final class RawExpr(val tree: tpd.Tree) extends quoted.Expr[Any] with RawQuoted

compiler/src/dotty/tools/dotc/interpreter/RawQuoted.scala

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@ package dotty.tools.dotc.interpreter
22

33
import dotty.tools.dotc.ast.tpd
44

5+
/** Quoted `quoted.Quoted` for which its internal representation is its tree.
6+
* - Used for trees that cannot be serialized, such as references to local symbols that will be spliced in.
7+
* - Used for trees that do not need to be serialized to avoid the overhead of serialization/deserialization.
8+
*/
59
trait RawQuoted extends quoted.Quoted {
610
def tree: tpd.Tree
11+
override def toString: String = s"${this.getClass.getName}(${tree.toString})"
712
}

compiler/src/dotty/tools/dotc/interpreter/RawType.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@ package dotty.tools.dotc.interpreter
22

33
import dotty.tools.dotc.ast.tpd
44

5-
class RawType(val tree: tpd.Tree) extends quoted.Type[Any] with RawQuoted {
6-
override def toString: String = s"RawType(${tree.toString})"
7-
}
5+
/** Type `quoted.Type[_]` for which its internal representation is its type tree. */
6+
final class RawType(val tree: tpd.Tree) extends quoted.Type[Any] with RawQuoted

0 commit comments

Comments
 (0)