@@ -112,7 +112,7 @@ object Macros {
112
112
import quotes .reflect ._
113
113
val owner = actualOwner(Symbol .spliceOwner)
114
114
val simpleName = Util .getName(owner)
115
- ' {Name ($ {Expr (simpleName)})}
115
+ ' {new Name ($ {Expr (simpleName)})}
116
116
}
117
117
118
118
private def adjustName (s : String ): String =
@@ -126,7 +126,7 @@ object Macros {
126
126
import quotes .reflect ._
127
127
val owner = nonMacroOwner(Symbol .spliceOwner)
128
128
val simpleName = adjustName(Util .getName(owner))
129
- ' {Name .Machine ($ {Expr (simpleName)})}
129
+ ' {new Name .Machine ($ {Expr (simpleName)})}
130
130
}
131
131
132
132
def fullNameImpl (using Quotes ): Expr [FullName ] = {
@@ -142,7 +142,7 @@ object Macros {
142
142
.filterNot(Util .isSyntheticName)
143
143
.map(cleanChunk)
144
144
.mkString(" ." )
145
- ' {FullName ($ {Expr (fullName)})}
145
+ ' {new FullName ($ {Expr (fullName)})}
146
146
}
147
147
148
148
def fullNameMachineImpl (using Quotes ): Expr [FullName .Machine ] = {
@@ -153,34 +153,34 @@ object Macros {
153
153
.map(_.stripPrefix(" _$" ).stripSuffix(" $" )) // meh
154
154
.map(adjustName)
155
155
.mkString(" ." )
156
- ' {FullName .Machine ($ {Expr (fullName)})}
156
+ ' {new FullName .Machine ($ {Expr (fullName)})}
157
157
}
158
158
159
159
def fileImpl (using Quotes ): Expr [sourcecode.File ] = {
160
160
import quotes .reflect ._
161
161
val file = quotes.reflect.Position .ofMacroExpansion.sourceFile.path
162
- ' {sourcecode.File ($ {Expr (file)})}
162
+ ' {new sourcecode.File ($ {Expr (file)})}
163
163
}
164
164
165
165
def fileNameImpl (using Quotes ): Expr [sourcecode.FileName ] = {
166
166
val name = quotes.reflect.Position .ofMacroExpansion.sourceFile.name
167
- ' {sourcecode.FileName ($ {Expr (name)})}
167
+ ' {new sourcecode.FileName ($ {Expr (name)})}
168
168
}
169
169
170
170
def lineImpl (using Quotes ): Expr [sourcecode.Line ] = {
171
171
val line = quotes.reflect.Position .ofMacroExpansion.startLine + 1
172
- ' {sourcecode.Line ($ {Expr (line)})}
172
+ ' {new sourcecode.Line ($ {Expr (line)})}
173
173
}
174
174
175
175
def enclosingImpl (using Quotes ): Expr [Enclosing ] = {
176
176
import quotes .reflect ._
177
177
val path = enclosing(machine = false )(! Util .isSynthetic(_))
178
- ' {Enclosing ($ {Expr (path)})}
178
+ ' {new Enclosing ($ {Expr (path)})}
179
179
}
180
180
181
181
def enclosingMachineImpl (using Quotes ): Expr [Enclosing .Machine ] = {
182
182
val path = enclosing(machine = true )(_ => true )
183
- ' {Enclosing .Machine ($ {Expr (path)})}
183
+ ' {new Enclosing .Machine ($ {Expr (path)})}
184
184
}
185
185
186
186
def pkgImpl (using Quotes ): Expr [Pkg ] = {
@@ -189,7 +189,7 @@ object Macros {
189
189
case _ => false
190
190
}
191
191
192
- ' {Pkg ($ {Expr (path)})}
192
+ ' {new Pkg ($ {Expr (path)})}
193
193
}
194
194
195
195
def argsImpl (using qctx : Quotes ): Expr [Args ] = {
@@ -217,21 +217,21 @@ object Macros {
217
217
218
218
val texts0 = param.map(_.foldRight(' {List .empty[Text [_]]}) {
219
219
case (vd @ ValDef (nme, _, _), l) =>
220
- ' {Text ($ {Ref (vd.symbol).asExpr}, $ {Expr (nme)}) :: $l}
220
+ ' {( new Text ($ {Ref (vd.symbol).asExpr}, $ {Expr (nme)}) ) :: $l}
221
221
})
222
222
val texts = texts0.foldRight(' {List .empty[List [Text [_]]]}) {
223
223
case (l, acc) =>
224
224
' {$l :: $acc}
225
225
}
226
226
227
- ' {Args ($texts)}
227
+ ' {new Args ($texts)}
228
228
}
229
229
230
230
231
231
def text [T : Type ](v : Expr [T ])(using Quotes ): Expr [sourcecode.Text [T ]] = {
232
232
import quotes .reflect ._
233
233
val txt = v.asTerm.pos.sourceCode.get
234
- ' {sourcecode.Text [T ]($v, $ {Expr (txt)})}
234
+ ' {new sourcecode.Text [T ]($v, $ {Expr (txt)})}
235
235
}
236
236
237
237
sealed trait Chunk
0 commit comments