Skip to content

Commit a4c3dcf

Browse files
committed
Add Ident factory in quoted
1 parent 73bb6c7 commit a4c3dcf

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

compiler/src/scala/quoted/runtime/impl/QuotesImpl.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -427,8 +427,19 @@ class QuotesImpl private (using val ctx: Context) extends Quotes, QuoteUnpickler
427427
end IdentTypeTest
428428

429429
object Ident extends IdentModule:
430+
def apply(name: String, tpe: TypeRepr, flags: Flags, privateWithing: Symbol): Ident =
431+
val symbol = Symbol.newVal(
432+
Symbol.spliceOwner,
433+
name,
434+
tpe,
435+
flags,
436+
privateWithing
437+
)
438+
tpd.ref(symbol).asInstanceOf[Ident]
439+
430440
def apply(tmref: TermRef): Term =
431441
withDefaultPos(tpd.ref(tmref).asInstanceOf[Term])
442+
432443
def copy(original: Tree)(name: String): Ident =
433444
tpd.cpy.Ident(original)(name.toTermName)
434445
def unapply(tree: Ident): Some[String] =

library/src/scala/quoted/Quotes.scala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,8 @@ trait Quotes { self: runtime.QuoteUnpickler & runtime.QuoteMatching =>
738738

739739
/** Methods of the module object `val Ident` */
740740
trait IdentModule { this: Ident.type =>
741+
def apply(name: String, tpe: TypeRepr, flags: Flags, privateWithing: Symbol): Ident
742+
741743
def apply(tmref: TermRef): Term
742744

743745
def copy(original: Tree)(name: String): Ident

0 commit comments

Comments
 (0)