File tree 1 file changed +4
-2
lines changed
1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,9 @@ object Macros {
11
11
def argsImpl (given qctx : QuoteContext ): Expr [FirstArg ] = {
12
12
import qctx .tasty .{_ , given }
13
13
14
- var enclosingCls : Symbol = rootContext.owner
14
+ def enclosingClass (cur : Symbol = rootContext.owner): Symbol =
15
+ if (cur.isClassDef) cur
16
+ else enclosingClass(cur.owner)
15
17
16
18
def enclosingParamList (owner : Symbol ): Seq [Seq [Symbol ]] =
17
19
if owner.isClassDef then
@@ -24,7 +26,7 @@ object Macros {
24
26
Literal (Constant (value)).seal.asInstanceOf [Expr [String ]]
25
27
val paramss = enclosingParamList(rootContext.owner)
26
28
val firstArg = paramss.flatten.head
27
- val ref = Select .unique(This (enclosingCls ), firstArg.name)
29
+ val ref = Select .unique(This (enclosingClass() ), firstArg.name)
28
30
' { FirstArg ($ {ref.seal}, $ {Expr (firstArg.name)}) }
29
31
}
30
32
}
You can’t perform that action at this time.
0 commit comments