File tree Expand file tree Collapse file tree 2 files changed +246
-250
lines changed Expand file tree Collapse file tree 2 files changed +246
-250
lines changed Original file line number Diff line number Diff line change 1+ package scala .internal .quoted
2+
3+ import scala .quoted .Expr
4+
5+ /** An Expr backed by a tree. Only the current compiler trees are allowed.
6+ *
7+ * These expressions are used for arguments of macros. They contain and actual tree
8+ * from the program that is being expanded by the macro.
9+ *
10+ * May contain references to code defined outside this TastyTreeExpr instance.
11+ */
12+ final class TastyTreeExpr [Tree ](val tree : Tree , val scopeId : Int ) extends Expr [Any ] {
13+ override def equals (that : Any ): Boolean = that match {
14+ case that : TastyTreeExpr [_] =>
15+ // TastyTreeExpr are wrappers around trees, therfore they are equals if their trees are equal.
16+ // All scopeId should be equal unless two different runs of the compiler created the trees.
17+ tree == that.tree && scopeId == that.scopeId
18+ case _ => false
19+ }
20+ override def hashCode : Int = tree.hashCode
21+ override def toString : String = s " Expr(<tasty tree>) "
22+ }
You can’t perform that action at this time.
0 commit comments