@@ -452,7 +452,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
452452 // ////////////
453453
454454 /** Context of the macro expansion */
455- implicit def rootContext : Context = internal.rootContext // TODO: Use given // TODO: Should this be moved to QuoteContext?
455+ given rootContext : Context = internal.rootContext // TODO: Use given // TODO: Should this be moved to QuoteContext?
456456
457457 given ContextOps : extension (self : Context ) {
458458 /** Returns the owner of the context */
@@ -1009,7 +1009,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
10091009 case _ => None
10101010 }
10111011
1012- def apply (tpe : MethodType , rhsFn : List [Tree ] => Tree )(implicit ctx : Context ): Block =
1012+ def apply (tpe : MethodType , rhsFn : List [Tree ] => Tree )(given ctx : Context ): Block =
10131013 internal.Lambda_apply (tpe, rhsFn)
10141014
10151015 }
@@ -2742,7 +2742,7 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
27422742 def foldTrees (x : X , trees : Iterable [Tree ])(given ctx : Context ): X = trees.foldLeft(x)(foldTree)
27432743
27442744 def foldOverTree (x : X , tree : Tree )(given ctx : Context ): X = {
2745- def localCtx ( definition : Definition ) : Context = definition .symbol.localContext
2745+ lazy val localCtx : Context = tree .symbol.localContext
27462746 tree match {
27472747 case Ident (_) =>
27482748 x
@@ -2785,16 +2785,16 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
27852785 case Inlined (call, bindings, expansion) =>
27862786 foldTree(foldTrees(x, bindings), expansion)
27872787 case vdef @ ValDef (_, tpt, rhs) =>
2788- implicit val ctx = localCtx(vdef)
2788+ given Context = localCtx
27892789 foldTrees(foldTree(x, tpt), rhs)
27902790 case ddef @ DefDef (_, tparams, vparamss, tpt, rhs) =>
2791- implicit val ctx = localCtx(ddef)
2791+ given Context = localCtx
27922792 foldTrees(foldTree(vparamss.foldLeft(foldTrees(x, tparams))(foldTrees), tpt), rhs)
27932793 case tdef @ TypeDef (_, rhs) =>
2794- implicit val ctx = localCtx(tdef)
2794+ given Context = localCtx
27952795 foldTree(x, rhs)
27962796 case cdef @ ClassDef (_, constr, parents, derived, self, body) =>
2797- implicit val ctx = localCtx(cdef)
2797+ given Context = localCtx
27982798 foldTrees(foldTrees(foldTrees(foldTrees(foldTree(x, constr), parents), derived), self), body)
27992799 case Import (expr, _) =>
28002800 foldTree(x, expr)
@@ -2862,20 +2862,20 @@ class Reflection(private[scala] val internal: CompilerInterface) { self =>
28622862 }
28632863
28642864 def transformStatement (tree : Statement )(given ctx : Context ): Statement = {
2865- def localCtx ( definition : Definition ) : Context = definition .symbol.localContext
2865+ lazy val localCtx : Context = tree .symbol.localContext
28662866 tree match {
28672867 case tree : Term =>
28682868 transformTerm(tree)
28692869 case tree : ValDef =>
2870- implicit val ctx = localCtx(tree)
2870+ given Context = localCtx
28712871 val tpt1 = transformTypeTree(tree.tpt)
28722872 val rhs1 = tree.rhs.map(x => transformTerm(x))
28732873 ValDef .copy(tree)(tree.name, tpt1, rhs1)
28742874 case tree : DefDef =>
2875- implicit val ctx = localCtx(tree)
2875+ given Context = localCtx
28762876 DefDef .copy(tree)(tree.name, transformSubTrees(tree.typeParams), tree.paramss mapConserve (transformSubTrees(_)), transformTypeTree(tree.returnTpt), tree.rhs.map(x => transformTerm(x)))
28772877 case tree : TypeDef =>
2878- implicit val ctx = localCtx(tree)
2878+ given Context = localCtx
28792879 TypeDef .copy(tree)(tree.name, transformTree(tree.rhs))
28802880 case tree : ClassDef =>
28812881 ClassDef .copy(tree)(tree.name, tree.constructor, tree.parents, tree.derived, tree.self, tree.body)
0 commit comments