Skip to content

Commit 64cda5b

Browse files
committed
Cleanup
1 parent 4b81c19 commit 64cda5b

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

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

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,9 @@ class ReifyQuotes extends MacroTransformWithImplicits {
7777
if (ctx.compilationUnit.needsStaging) super.run
7878

7979
protected def newTransformer(implicit ctx: Context): Transformer =
80-
new Reifier(inQuote = false, null, 0, new LevelInfo, new Embedded, ctx)
80+
new Reifier(inQuote = false, null, 0, new Info, new Embedded, ctx)
8181

82-
private class LevelInfo {
82+
private class Info {
8383

8484
/** Register a reference defined in a quote but used in another quote nested in a splice.
8585
* Returns a version of the reference that needs to be used in its place.
@@ -95,6 +95,7 @@ class ReifyQuotes extends MacroTransformWithImplicits {
9595
* See `isCaptured`
9696
*/
9797
val capturers = new mutable.HashMap[Symbol, Tree => Tree]
98+
9899
}
99100

100101
/** The main transformer class
@@ -105,17 +106,17 @@ class ReifyQuotes extends MacroTransformWithImplicits {
105106
* and `l == -1` is code inside a top level splice (in an inline method).
106107
* @param levels a stacked map from symbols to the levels in which they were defined
107108
* @param embedded a list of embedded quotes (if `inSplice = true`) or splices (if `inQuote = true`
108-
* @param rctx the contex in the destination lifted lambda
109+
* @param rctx the context in the destination lifted lambda
109110
*/
110-
private class Reifier(inQuote: Boolean, val outer: Reifier, val level: Int, levels: LevelInfo,
111+
private class Reifier(inQuote: Boolean, val outer: Reifier, val level: Int, info: Info,
111112
val embedded: Embedded, val rctx: Context) extends ImplicitsTransformer {
112-
import levels._
113+
import info._
113114
assert(level >= -1)
114115

115116
/** A nested reifier for a quote (if `isQuote = true`) or a splice (if not) */
116117
def nested(isQuote: Boolean)(implicit ctx: Context): Reifier = {
117118
val nestedEmbedded = if (level > 1 || (level == 1 && isQuote)) embedded else new Embedded
118-
new Reifier(isQuote, this, if (isQuote) level + 1 else level - 1, levels, nestedEmbedded, ctx)
119+
new Reifier(isQuote, this, if (isQuote) level + 1 else level - 1, info, nestedEmbedded, ctx)
119120
}
120121

121122
/** A stack of entered symbols, to be unwound after scope exit */
@@ -125,7 +126,7 @@ class ReifyQuotes extends MacroTransformWithImplicits {
125126
def markDef(tree: Tree)(implicit ctx: Context): Unit = tree match {
126127
case tree: DefTree =>
127128
val sym = tree.symbol
128-
if ((sym.isClass || !sym.maybeOwner.isType)) {
129+
if (sym.isClass || !sym.maybeOwner.isType) {
129130
enteredSyms = sym :: enteredSyms
130131
}
131132
case _ =>
@@ -327,10 +328,7 @@ class ReifyQuotes extends MacroTransformWithImplicits {
327328
reporting.trace(i"reify $tree at $level", show = true) {
328329
def mapOverTree(lastEntered: List[Symbol]) =
329330
try super.transform(tree)
330-
finally
331-
while (enteredSyms ne lastEntered) {
332-
enteredSyms = enteredSyms.tail
333-
}
331+
finally enteredSyms = lastEntered
334332
tree match {
335333
case Quoted(quotedTree) =>
336334
quotation(quotedTree, tree)
@@ -363,7 +361,7 @@ class ReifyQuotes extends MacroTransformWithImplicits {
363361
case tree: DefDef if tree.symbol.is(Macro) && level > 0 =>
364362
EmptyTree
365363
case tree: DefDef if tree.symbol.is(Macro) && level == 0 =>
366-
tree // Do nothin in this phase
364+
tree // Do nothing in this phase
367365
case _ =>
368366
markDef(tree)
369367
mapOverTree(enteredSyms)

0 commit comments

Comments
 (0)