File tree Expand file tree Collapse file tree 3 files changed +30
-0
lines changed Expand file tree Collapse file tree 3 files changed +30
-0
lines changed File renamed without changes.
Original file line number Diff line number Diff line change
1
+ import scala .quoted .*
2
+
3
+ package jam {
4
+ trait JamCoreDsl {
5
+ implicit inline def defaultJamConfig : this .JamConfig =
6
+ new JamConfig (brewRecRegex = " .*" )
7
+ class JamConfig (val brewRecRegex : String )
8
+ inline def brew (implicit inline config : JamConfig ): Unit = $ { brewImpl() }
9
+ }
10
+ private object internal extends JamCoreDsl
11
+ export internal ._
12
+
13
+ def brewImpl (using q : Quotes )(): Expr [Unit ] = {
14
+ findSelf
15
+ ' {()}
16
+ }
17
+
18
+ private def findSelf (using q : Quotes ): Unit = {
19
+ import q .reflect .*
20
+ def rec (s : Symbol ): Option [Symbol ] = s.maybeOwner match {
21
+ case o if o.isNoSymbol => None
22
+ case o if o.isClassDef => Option (o)
23
+ case o => rec(o)
24
+ }
25
+ rec(Symbol .spliceOwner)
26
+ }
27
+ }
Original file line number Diff line number Diff line change
1
+ object CoreSpec {
2
+ jam.brew
3
+ }
You can’t perform that action at this time.
0 commit comments