Skip to content

Commit d4b2f09

Browse files
committed
Rename Quote.{expr=>body}
Quotes can contain terms `'{..}` or types `'[..]`.
1 parent 3976d06 commit d4b2f09

File tree

15 files changed

+41
-41
lines changed

15 files changed

+41
-41
lines changed

compiler/src/dotty/tools/dotc/ast/Desugar.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1986,13 +1986,13 @@ object desugar {
19861986
trees foreach collect
19871987
case Block(Nil, expr) =>
19881988
collect(expr)
1989-
case Quote(expr) =>
1989+
case Quote(body) =>
19901990
new UntypedTreeTraverser {
19911991
def traverse(tree: untpd.Tree)(using Context): Unit = tree match {
19921992
case Splice(expr) => collect(expr)
19931993
case _ => traverseChildren(tree)
19941994
}
1995-
}.traverse(expr)
1995+
}.traverse(body)
19961996
case CapturingTypeTree(refs, parent) =>
19971997
collect(parent)
19981998
case _ =>

compiler/src/dotty/tools/dotc/ast/Trees.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,7 @@ object Trees {
687687
*
688688
* @param expr The tree that was quoted
689689
*/
690-
case class Quote[+T <: Untyped] private[ast] (expr: Tree[T])(implicit @constructorOnly src: SourceFile)
690+
case class Quote[+T <: Untyped] private[ast] (body: Tree[T])(implicit @constructorOnly src: SourceFile)
691691
extends TermTree[T] {
692692
type ThisTree[+T <: Untyped] = Quote[T]
693693

@@ -1305,9 +1305,9 @@ object Trees {
13051305
case tree: Inlined if (call eq tree.call) && (bindings eq tree.bindings) && (expansion eq tree.expansion) => tree
13061306
case _ => finalize(tree, untpd.Inlined(call, bindings, expansion)(sourceFile(tree)))
13071307
}
1308-
def Quote(tree: Tree)(expr: Tree)(using Context): Quote = tree match {
1309-
case tree: Quote if (expr eq tree.expr) => tree
1310-
case _ => finalize(tree, untpd.Quote(expr)(sourceFile(tree)))
1308+
def Quote(tree: Tree)(body: Tree)(using Context): Quote = tree match {
1309+
case tree: Quote if (body eq tree.body) => tree
1310+
case _ => finalize(tree, untpd.Quote(body)(sourceFile(tree)))
13111311
}
13121312
def Splice(tree: Tree)(expr: Tree)(using Context): Splice = tree match {
13131313
case tree: Splice if (expr eq tree.expr) => tree
@@ -1550,8 +1550,8 @@ object Trees {
15501550
case Thicket(trees) =>
15511551
val trees1 = transform(trees)
15521552
if (trees1 eq trees) tree else Thicket(trees1)
1553-
case tree @ Quote(expr) =>
1554-
cpy.Quote(tree)(transform(expr))
1553+
case tree @ Quote(body) =>
1554+
cpy.Quote(tree)(transform(body))
15551555
case tree @ Splice(expr) =>
15561556
cpy.Splice(tree)(transform(expr))
15571557
case tree @ Hole(_, _, args, content, tpt) =>
@@ -1695,8 +1695,8 @@ object Trees {
16951695
this(this(x, arg), annot)
16961696
case Thicket(ts) =>
16971697
this(x, ts)
1698-
case Quote(expr) =>
1699-
this(x, expr)
1698+
case Quote(body) =>
1699+
this(x, body)
17001700
case Splice(expr) =>
17011701
this(x, expr)
17021702
case Hole(_, _, args, content, tpt) =>

compiler/src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
170170
def Inlined(call: Tree, bindings: List[MemberDef], expansion: Tree)(using Context): Inlined =
171171
ta.assignType(untpd.Inlined(call, bindings, expansion), bindings, expansion)
172172

173-
def Quote(expr: Tree, tpe: Type)(using Context): Quote =
174-
untpd.Quote(expr).withExprType(tpe)
173+
def Quote(body: Tree, tpe: Type)(using Context): Quote =
174+
untpd.Quote(body).withExprType(tpe)
175175

176176
def Splice(expr: Tree, tpe: Type)(using Context): Splice =
177177
untpd.Splice(expr).withType(tpe)

compiler/src/dotty/tools/dotc/ast/untpd.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
397397
def SeqLiteral(elems: List[Tree], elemtpt: Tree)(implicit src: SourceFile): SeqLiteral = new SeqLiteral(elems, elemtpt)
398398
def JavaSeqLiteral(elems: List[Tree], elemtpt: Tree)(implicit src: SourceFile): JavaSeqLiteral = new JavaSeqLiteral(elems, elemtpt)
399399
def Inlined(call: tpd.Tree, bindings: List[MemberDef], expansion: Tree)(implicit src: SourceFile): Inlined = new Inlined(call, bindings, expansion)
400-
def Quote(expr: Tree)(implicit src: SourceFile): Quote = new Quote(expr)
400+
def Quote(body: Tree)(implicit src: SourceFile): Quote = new Quote(body)
401401
def Splice(expr: Tree)(implicit src: SourceFile): Splice = new Splice(expr)
402402
def TypeTree()(implicit src: SourceFile): TypeTree = new TypeTree()
403403
def InferredTypeTree()(implicit src: SourceFile): TypeTree = new InferredTypeTree()

compiler/src/dotty/tools/dotc/core/tasty/TreePickler.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -665,12 +665,12 @@ class TreePickler(pickler: TastyPickler) {
665665
pickleTree(hi)
666666
pickleTree(alias)
667667
}
668-
case tree @ Quote(expr) =>
668+
case tree @ Quote(body) =>
669669
pickleTree(
670-
// scala.quoted.runtime.Expr.quoted[<tree.exprType>](<expr>)
670+
// scala.quoted.runtime.Expr.quoted[<tree.exprType>](<body>)
671671
ref(defn.QuotedRuntime_exprQuote)
672672
.appliedToType(tree.exprType)
673-
.appliedTo(expr)
673+
.appliedTo(body)
674674
.withSpan(tree.span)
675675
)
676676
case Splice(expr) =>

compiler/src/dotty/tools/dotc/parsing/Parsers.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2494,10 +2494,10 @@ object Parsers {
24942494
case QUOTE =>
24952495
atSpan(in.skipToken()) {
24962496
withinStaged(StageKind.Quoted | (if (location.inPattern) StageKind.QuotedPattern else 0)) {
2497-
val expr =
2497+
val body =
24982498
if (in.token == LBRACKET) inBrackets(typ())
24992499
else stagedBlock()
2500-
Quote(expr)
2500+
Quote(body)
25012501
}
25022502
}
25032503
case NEW =>

compiler/src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -716,9 +716,9 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
716716
"Thicket {" ~~ toTextGlobal(trees, "\n") ~~ "}"
717717
case MacroTree(call) =>
718718
keywordStr("macro ") ~ toTextGlobal(call)
719-
case tree @ Quote(expr) =>
719+
case tree @ Quote(body) =>
720720
val exprTypeText = (keywordStr("[") ~ toTextGlobal(tree.exprType) ~ keywordStr("]")).provided(printDebug && tree.typeOpt.exists)
721-
keywordStr("'") ~ exprTypeText ~ keywordStr("{") ~ toTextGlobal(expr) ~ keywordStr("}")
721+
keywordStr("'") ~ exprTypeText ~ keywordStr("{") ~ toTextGlobal(body) ~ keywordStr("}")
722722
case Splice(expr) =>
723723
val spliceTypeText = (keywordStr("[") ~ toTextGlobal(tree.typeOpt) ~ keywordStr("]")).provided(printDebug && tree.typeOpt.exists)
724724
keywordStr("$") ~ spliceTypeText ~ keywordStr("{") ~ toTextGlobal(expr) ~ keywordStr("}")

compiler/src/dotty/tools/dotc/transform/MegaPhase.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ class MegaPhase(val miniPhases: Array[MiniPhase]) extends Phase {
401401
}
402402
case tree: Quote =>
403403
inContext(prepQuote(tree, start)(using outerCtx)) {
404-
val expr = transformTree(tree.expr, start)(using quoteContext)
405-
goQuote(cpy.Quote(tree)(expr), start)
404+
val body = transformTree(tree.body, start)(using quoteContext)
405+
goQuote(cpy.Quote(tree)(body), start)
406406
}
407407
case tree: Splice =>
408408
inContext(prepSplice(tree, start)(using outerCtx)) {

compiler/src/dotty/tools/dotc/transform/PickleQuotes.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ class PickleQuotes extends MacroTransform {
101101
override def transform(tree: tpd.Tree)(using Context): tpd.Tree =
102102
tree match
103103
case Apply(Select(quote: Quote, nme.apply), List(quotes)) =>
104-
val (contents, codeWithHoles) = makeHoles(quote.expr)
104+
val (contents, codeWithHoles) = makeHoles(quote.body)
105105
val sourceRef = Inlines.inlineCallTrace(ctx.owner, tree.sourcePos)
106106
val codeWithHoles2 = Inlined(sourceRef, Nil, codeWithHoles)
107107
val pickled = PickleQuotes(quotes, codeWithHoles2, contents, quote.exprType, false)

compiler/src/dotty/tools/dotc/transform/PostTyper.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ class PostTyper extends MacroTransform with IdentityDenotTransformer { thisPhase
485485
)
486486
case Block(_, Closure(_, _, tpt)) if ExpandSAMs.needsWrapperClass(tpt.tpe) =>
487487
superAcc.withInvalidCurrentClass(super.transform(tree))
488-
case Quote(expr) =>
488+
case _: Quote =>
489489
ctx.compilationUnit.needsStaging = true
490490
super.transform(tree)
491491
case tree =>

0 commit comments

Comments
 (0)