@@ -148,13 +148,8 @@ object CompilationUnit {
148148 assert(! unpickled.isEmpty, unpickled)
149149 val unit1 = new CompilationUnit (source, info)
150150 unit1.tpdTree = unpickled
151- if (forceTrees) {
152- val force = new Force
153- force.traverse(unit1.tpdTree)
154- unit1.needsStaging = force.containsQuote
155- unit1.needsInlining = force.containsInline
156- unit1.hasMacroAnnotations = force.containsMacroAnnotation
157- }
151+ if forceTrees then
152+ Force .traverse(unit1.tpdTree)(using ctx.fresh.setCompilationUnit(unit1))
158153 unit1
159154 }
160155
@@ -187,19 +182,15 @@ object CompilationUnit {
187182 }
188183
189184 /** Force the tree to be loaded */
190- private class Force extends TreeTraverser {
191- var containsQuote = false
192- var containsInline = false
193- var containsCaptureChecking = false
194- var containsMacroAnnotation = false
185+ private object Force extends TreeTraverser {
195186 def traverse (tree : Tree )(using Context ): Unit = {
196187 if tree.symbol.is(Flags .Inline ) then
197- containsInline = true
188+ ctx.compilationUnit.needsStaging = true
198189 tree match
199190 case _ : tpd.Quote =>
200- containsQuote = true
191+ ctx.compilationUnit.needsStaging = true
201192 case tree : tpd.Apply if tree.symbol == defn.QuotedTypeModule_of =>
202- containsQuote = true
193+ ctx.compilationUnit.needsStaging = true
203194 case Import (qual, selectors) =>
204195 tpd.languageImport(qual) match
205196 case Some (prefix) =>
0 commit comments