@@ -99,12 +99,7 @@ class PickleQuotes extends MacroTransform {
99
99
override def transform (tree : tpd.Tree )(using Context ): tpd.Tree =
100
100
tree match
101
101
case Apply (Select (quote : Quote , nme.apply), List (quotes)) =>
102
- val (contents, codeWithHoles) = makeHoles(quote.body)
103
- val sourceRef = Inlines .inlineCallTrace(ctx.owner, tree.sourcePos)
104
- val bodyWithHoles2 =
105
- if quote.isTypeQuote then codeWithHoles
106
- else Inlined (sourceRef, Nil , codeWithHoles)
107
- val quote1 = cpy.Quote (quote)(body = bodyWithHoles2)
102
+ val (contents, quote1) = makeHoles(quote)
108
103
val pickled = PickleQuotes .pickle(quote1, quotes, contents)
109
104
transform(pickled) // pickle quotes that are in the contents
110
105
case tree : DefDef if ! tree.rhs.isEmpty && tree.symbol.isInlineMethod =>
@@ -115,8 +110,7 @@ class PickleQuotes extends MacroTransform {
115
110
super .transform(tree)
116
111
}
117
112
118
- private def makeHoles (tree : tpd.Tree )(using Context ): (List [Tree ], tpd.Tree ) =
119
-
113
+ private def makeHoles (quote : tpd.Quote )(using Context ): (List [Tree ], tpd.Quote ) =
120
114
class HoleContentExtractor extends Transformer :
121
115
private val contents = List .newBuilder[Tree ]
122
116
override def transform (tree : tpd.Tree )(using Context ): tpd.Tree =
@@ -187,10 +181,13 @@ class PickleQuotes extends MacroTransform {
187
181
end HoleContentExtractor
188
182
189
183
val holeMaker = new HoleContentExtractor
190
- val newTree = holeMaker.transform(tree)
191
- (holeMaker.getContents(), newTree)
192
-
184
+ val body1 = holeMaker.transform(quote.body)
185
+ val body2 =
186
+ if quote.isTypeQuote then body1
187
+ else Inlined (Inlines .inlineCallTrace(ctx.owner, quote.sourcePos), Nil , body1)
188
+ val quote1 = cpy.Quote (quote)(body2)
193
189
190
+ (holeMaker.getContents(), quote1)
194
191
end makeHoles
195
192
196
193
}
0 commit comments