Skip to content

Commit 5e8eb8e

Browse files
Merge pull request #2 from dotty-staging/use-new-splices
Use new splice syntax
2 parents bed617b + 58f0d4d commit 5e8eb8e

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

sourcecode/shared/src/main/dotty/sourcecode/Macros.scala

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,57 +7,57 @@ import scala.tasty.Reflection
77

88
trait NameMacros {
99
inline implicit def generate: Name =
10-
~Macros.nameImpl
10+
${ Macros.nameImpl }
1111
}
1212

1313
trait NameMachineMacros {
1414
inline implicit def generate: Name.Machine =
15-
~Macros.nameMachineImpl
15+
${ Macros.nameMachineImpl }
1616
}
1717

1818
trait FullNameMacros {
1919
inline implicit def generate: FullName =
20-
~Macros.fullNameImpl
20+
${ Macros.fullNameImpl }
2121
}
2222

2323
trait FullNameMachineMacros {
2424
inline implicit def generate: FullName.Machine =
25-
~Macros.fullNameMachineImpl
25+
${ Macros.fullNameMachineImpl }
2626
}
2727

2828
trait FileMacros {
2929
inline implicit def generate: sourcecode.File =
30-
~Macros.fileImpl
30+
${ Macros.fileImpl }
3131
}
3232

3333
trait LineMacros {
3434
inline implicit def generate: sourcecode.Line =
35-
~Macros.lineImpl
35+
${ Macros.lineImpl }
3636
}
3737

3838
trait EnclosingMacros {
3939
inline implicit def generate: Enclosing =
40-
~Macros.enclosingImpl
40+
${ Macros.enclosingImpl }
4141
}
4242

4343
trait EnclosingMachineMacros {
4444
inline implicit def generate: Enclosing.Machine =
45-
~Macros.enclosingMachineImpl
45+
${ Macros.enclosingMachineImpl }
4646
}
4747

4848
trait PkgMacros {
4949
inline implicit def generate: Pkg =
50-
~Macros.pkgImpl
50+
${ Macros.pkgImpl }
5151
}
5252

5353
trait TextMacros {
54-
inline implicit def generate[T](v: => T): Text[T] = ~Macros.text('(v))
55-
inline def apply[T](v: => T): Text[T] = ~Macros.text('(v))
54+
inline implicit def generate[T](v: => T): Text[T] = ${ Macros.text('v) }
55+
inline def apply[T](v: => T): Text[T] = ${ Macros.text('v) }
5656
}
5757

5858
trait ArgsMacros {
5959
inline implicit def generate: Args =
60-
~Macros.argsImpl
60+
${ Macros.argsImpl }
6161
}
6262

6363
object Util{
@@ -88,7 +88,7 @@ object Macros {
8888
import c._
8989
val owner = actualOwner(c)(c.rootContext.owner)
9090
val simpleName = Util.getName(c)(owner)
91-
'(Name(~simpleName.toExpr))
91+
'{Name(${simpleName.toExpr})}
9292
}
9393

9494
private def adjustName(s: String): String =
@@ -102,7 +102,7 @@ object Macros {
102102
import c._
103103
val owner = c.rootContext.owner
104104
val simpleName = adjustName(Util.getName(c)(owner))
105-
'(Name.Machine(~simpleName.toExpr))
105+
'{Name.Machine(${simpleName.toExpr})}
106106
}
107107

108108
def fullNameImpl(implicit c: Reflection): Expr[FullName] = {
@@ -114,7 +114,7 @@ object Macros {
114114
.filterNot(Util.isSyntheticName)
115115
.map(_.stripPrefix("_$").stripSuffix("$")) // meh
116116
.mkString(".")
117-
'(FullName(~fullName.toExpr))
117+
'{FullName(${fullName.toExpr})}
118118
}
119119

120120
def fullNameMachineImpl(implicit c: Reflection): Expr[FullName.Machine] = {
@@ -125,32 +125,32 @@ object Macros {
125125
.map(_.stripPrefix("_$").stripSuffix("$")) // meh
126126
.map(adjustName)
127127
.mkString(".")
128-
'(FullName.Machine(~fullName.toExpr))
128+
'{FullName.Machine(${fullName.toExpr})}
129129
}
130130

131131
def fileImpl(implicit c: Reflection): Expr[sourcecode.File] = {
132132
import c._
133133
val file = c.rootPosition.sourceFile.toAbsolutePath.toString
134-
'(sourcecode.File(~file.toExpr))
134+
'{sourcecode.File(${file.toExpr})}
135135
}
136136

137137
def lineImpl(implicit c: Reflection): Expr[sourcecode.Line] = {
138138
import c._
139139
val line = c.rootPosition.startLine + 1
140-
'(sourcecode.Line(~line.toExpr))
140+
'{sourcecode.Line(${line.toExpr})}
141141
}
142142

143143
def enclosingImpl(implicit c: Reflection): Expr[Enclosing] = {
144144
val path = enclosing(c)(
145145
!Util.isSynthetic(c)(_)
146146
)
147147

148-
'(Enclosing(~path.toExpr))
148+
'{Enclosing(${path.toExpr})}
149149
}
150150

151151
def enclosingMachineImpl(implicit c: Reflection): Expr[Enclosing.Machine] = {
152152
val path = enclosing(c, machine = true)(_ => true)
153-
'(Enclosing.Machine(~path.toExpr))
153+
'{Enclosing.Machine(${path.toExpr})}
154154
}
155155

156156
def pkgImpl(implicit c: Reflection): Expr[Pkg] = {
@@ -160,7 +160,7 @@ object Macros {
160160
case _ => false
161161
}
162162

163-
'(Pkg(~path.toExpr))
163+
'{Pkg(${path.toExpr})}
164164
}
165165

166166
def argsImpl(implicit c: Reflection): Expr[Args] = {
@@ -180,24 +180,24 @@ object Macros {
180180
nearestEnclosingMethod(c.rootContext.owner)
181181
}
182182

183-
val texts0 = param.map(_.foldRight('(List.empty[Text[_]])) {
183+
val texts0 = param.map(_.foldRight('{List.empty[Text[_]]}) {
184184
case (vd @ ValDef(nme, _, optV), l) =>
185-
'(Text(~{optV.fold('(None))(v => new TastyTreeExpr(v))}, ~nme.toExpr) :: ~l)
185+
'{Text(${optV.fold('None)(v => new TastyTreeExpr(v))}, ${nme.toExpr}) :: $l}
186186
})
187-
val texts = texts0.foldRight('(List.empty[List[Text[_]]])) {
187+
val texts = texts0.foldRight('{List.empty[List[Text[_]]]}) {
188188
case (l, acc) =>
189-
'(~l :: ~acc)
189+
'{$l :: $acc}
190190
}
191191

192-
'(Args(~texts))
192+
'{Args($texts)}
193193
}
194194

195195

196196
def text[T: Type](v: Expr[T])(implicit c: Reflection): Expr[sourcecode.Text[T]] = {
197197
import c._
198198
import scala.quoted.Toolbox.Default._
199199
val txt = v.show
200-
'(sourcecode.Text[T](~v, ~txt.toExpr))
200+
'{sourcecode.Text[T]($v, ${txt.toExpr})}
201201
}
202202

203203
sealed trait Chunk

0 commit comments

Comments
 (0)