@@ -99,12 +99,7 @@ class PickleQuotes extends MacroTransform {
9999 override def transform (tree : tpd.Tree )(using Context ): tpd.Tree =
100100 tree match
101101 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)
108103 val pickled = PickleQuotes .pickle(quote1, quotes, contents)
109104 transform(pickled) // pickle quotes that are in the contents
110105 case tree : DefDef if ! tree.rhs.isEmpty && tree.symbol.isInlineMethod =>
@@ -115,8 +110,7 @@ class PickleQuotes extends MacroTransform {
115110 super .transform(tree)
116111 }
117112
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 ) =
120114 class HoleContentExtractor extends Transformer :
121115 private val contents = List .newBuilder[Tree ]
122116 override def transform (tree : tpd.Tree )(using Context ): tpd.Tree =
@@ -187,10 +181,13 @@ class PickleQuotes extends MacroTransform {
187181 end HoleContentExtractor
188182
189183 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)
193189
190+ (holeMaker.getContents(), quote1)
194191 end makeHoles
195192
196193}
0 commit comments