@@ -19,7 +19,7 @@ import dotty.tools.dotc.report
19
19
20
20
import scala .reflect .ClassTag
21
21
22
- import scala .quoted .QuoteContext
22
+ import scala .quoted .Quotes
23
23
import scala .quoted .runtime .impl ._
24
24
25
25
import scala .collection .mutable
@@ -41,19 +41,19 @@ object PickledQuotes {
41
41
/** Transform the expression into its fully spliced Tree */
42
42
def quotedExprToTree [T ](expr : quoted.Expr [T ])(using Context ): Tree = {
43
43
val expr1 = expr.asInstanceOf [ExprImpl ]
44
- expr1.checkScopeId(QuoteContextImpl .scopeId)
44
+ expr1.checkScopeId(QuotesImpl .scopeId)
45
45
changeOwnerOfTree(expr1.tree, ctx.owner)
46
46
}
47
47
48
48
/** Transform the expression into its fully spliced TypeTree */
49
49
def quotedTypeToTree (tpe : quoted.Type [? ])(using Context ): Tree = {
50
50
val tpe1 = tpe.asInstanceOf [TypeImpl ]
51
- tpe1.checkScopeId(QuoteContextImpl .scopeId)
51
+ tpe1.checkScopeId(QuotesImpl .scopeId)
52
52
changeOwnerOfTree(tpe1.typeTree, ctx.owner)
53
53
}
54
54
55
55
/** Unpickle the tree contained in the TastyExpr */
56
- def unpickleTerm (pickled : String | List [String ], typeHole : (Int , Seq [Any ]) => scala.quoted.Type [? ], termHole : (Int , Seq [Any ], scala.quoted.QuoteContext ) => scala.quoted.Expr [? ])(using Context ): Tree = {
56
+ def unpickleTerm (pickled : String | List [String ], typeHole : (Int , Seq [Any ]) => scala.quoted.Type [? ], termHole : (Int , Seq [Any ], scala.quoted.Quotes ) => scala.quoted.Expr [? ])(using Context ): Tree = {
57
57
val unpickled = withMode(Mode .ReadPositions )(unpickle(pickled, isType = false ))
58
58
val Inlined (call, Nil , expnasion) = unpickled
59
59
val inlineCtx = inlineContext(call)
@@ -63,22 +63,22 @@ object PickledQuotes {
63
63
}
64
64
65
65
/** Unpickle the tree contained in the TastyType */
66
- def unpickleTypeTree (pickled : String | List [String ], typeHole : (Int , Seq [Any ]) => scala.quoted.Type [? ], termHole : (Int , Seq [Any ], scala.quoted.QuoteContext ) => scala.quoted.Expr [? ])(using Context ): Tree = {
66
+ def unpickleTypeTree (pickled : String | List [String ], typeHole : (Int , Seq [Any ]) => scala.quoted.Type [? ], termHole : (Int , Seq [Any ], scala.quoted.Quotes ) => scala.quoted.Expr [? ])(using Context ): Tree = {
67
67
val unpickled = withMode(Mode .ReadPositions )(unpickle(pickled, isType = true ))
68
68
spliceTypes(unpickled, typeHole, termHole)
69
69
}
70
70
71
71
/** Replace all term holes with the spliced terms */
72
- private def spliceTerms (tree : Tree , typeHole : (Int , Seq [Any ]) => scala.quoted.Type [? ], termHole : (Int , Seq [Any ], scala.quoted.QuoteContext ) => scala.quoted.Expr [? ])(using Context ): Tree = {
72
+ private def spliceTerms (tree : Tree , typeHole : (Int , Seq [Any ]) => scala.quoted.Type [? ], termHole : (Int , Seq [Any ], scala.quoted.Quotes ) => scala.quoted.Expr [? ])(using Context ): Tree = {
73
73
val evaluateHoles = new TreeMap {
74
74
override def transform (tree : tpd.Tree )(using Context ): tpd.Tree = tree match {
75
75
case Hole (isTerm, idx, args) =>
76
76
val reifiedArgs = args.map { arg =>
77
- if (arg.isTerm) (using qctx : QuoteContext ) => new ExprImpl (arg, QuoteContextImpl .scopeId)
78
- else new TypeImpl (arg, QuoteContextImpl .scopeId)
77
+ if (arg.isTerm) (using q : Quotes ) => new ExprImpl (arg, QuotesImpl .scopeId)
78
+ else new TypeImpl (arg, QuotesImpl .scopeId)
79
79
}
80
80
if isTerm then
81
- val quotedExpr = termHole(idx, reifiedArgs, QuoteContextImpl ())
81
+ val quotedExpr = termHole(idx, reifiedArgs, QuotesImpl ())
82
82
val filled = PickledQuotes .quotedExprToTree(quotedExpr)
83
83
84
84
// We need to make sure a hole is created with the source file of the surrounding context, even if
@@ -123,7 +123,7 @@ object PickledQuotes {
123
123
}
124
124
125
125
/** Replace all type holes generated with the spliced types */
126
- private def spliceTypes (tree : Tree , typeHole : (Int , Seq [Any ]) => scala.quoted.Type [? ], termHole : (Int , Seq [Int ], scala.quoted.QuoteContext ) => Any )(using Context ): Tree = {
126
+ private def spliceTypes (tree : Tree , typeHole : (Int , Seq [Any ]) => scala.quoted.Type [? ], termHole : (Int , Seq [Int ], scala.quoted.Quotes ) => Any )(using Context ): Tree = {
127
127
tree match
128
128
case Block (stat :: rest, expr1) if stat.symbol.hasAnnotation(defn.QuotedRuntime_SplicedTypeAnnot ) =>
129
129
val typeSpliceMap = (stat :: rest).iterator.map {
0 commit comments