File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ object Macros {
1111 def argsImpl (given qctx : QuoteContext ): Expr [FirstArg ] = {
1212 import qctx .tasty .{_ , given }
1313
14- var enclosingCls : Symbol = rootContext.owner
14+ def enclosingClass (cur : Symbol = rootContext.owner): Symbol =
15+ if (cur.isClassDef) cur
16+ else enclosingClass(cur.owner)
1517
1618 def enclosingParamList (owner : Symbol ): Seq [Seq [Symbol ]] =
1719 if owner.isClassDef then
@@ -24,7 +26,7 @@ object Macros {
2426 Literal (Constant (value)).seal.asInstanceOf [Expr [String ]]
2527 val paramss = enclosingParamList(rootContext.owner)
2628 val firstArg = paramss.flatten.head
27- val ref = Select .unique(This (enclosingCls ), firstArg.name)
29+ val ref = Select .unique(This (enclosingClass() ), firstArg.name)
2830 ' { FirstArg ($ {ref.seal}, $ {Expr (firstArg.name)}) }
2931 }
3032}
You can’t perform that action at this time.
0 commit comments