@@ -77,9 +77,9 @@ class ReifyQuotes extends MacroTransformWithImplicits {
77
77
if (ctx.compilationUnit.needsStaging) super .run
78
78
79
79
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)
81
81
82
- private class LevelInfo {
82
+ private class Info {
83
83
84
84
/** Register a reference defined in a quote but used in another quote nested in a splice.
85
85
* Returns a version of the reference that needs to be used in its place.
@@ -95,6 +95,7 @@ class ReifyQuotes extends MacroTransformWithImplicits {
95
95
* See `isCaptured`
96
96
*/
97
97
val capturers = new mutable.HashMap [Symbol , Tree => Tree ]
98
+
98
99
}
99
100
100
101
/** The main transformer class
@@ -105,17 +106,17 @@ class ReifyQuotes extends MacroTransformWithImplicits {
105
106
* and `l == -1` is code inside a top level splice (in an inline method).
106
107
* @param levels a stacked map from symbols to the levels in which they were defined
107
108
* @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
109
110
*/
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 ,
111
112
val embedded : Embedded , val rctx : Context ) extends ImplicitsTransformer {
112
- import levels ._
113
+ import info ._
113
114
assert(level >= - 1 )
114
115
115
116
/** A nested reifier for a quote (if `isQuote = true`) or a splice (if not) */
116
117
def nested (isQuote : Boolean )(implicit ctx : Context ): Reifier = {
117
118
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)
119
120
}
120
121
121
122
/** A stack of entered symbols, to be unwound after scope exit */
@@ -125,7 +126,7 @@ class ReifyQuotes extends MacroTransformWithImplicits {
125
126
def markDef (tree : Tree )(implicit ctx : Context ): Unit = tree match {
126
127
case tree : DefTree =>
127
128
val sym = tree.symbol
128
- if (( sym.isClass || ! sym.maybeOwner.isType) ) {
129
+ if (sym.isClass || ! sym.maybeOwner.isType) {
129
130
enteredSyms = sym :: enteredSyms
130
131
}
131
132
case _ =>
@@ -327,10 +328,7 @@ class ReifyQuotes extends MacroTransformWithImplicits {
327
328
reporting.trace(i " reify $tree at $level" , show = true ) {
328
329
def mapOverTree (lastEntered : List [Symbol ]) =
329
330
try super .transform(tree)
330
- finally
331
- while (enteredSyms ne lastEntered) {
332
- enteredSyms = enteredSyms.tail
333
- }
331
+ finally enteredSyms = lastEntered
334
332
tree match {
335
333
case Quoted (quotedTree) =>
336
334
quotation(quotedTree, tree)
@@ -363,7 +361,7 @@ class ReifyQuotes extends MacroTransformWithImplicits {
363
361
case tree : DefDef if tree.symbol.is(Macro ) && level > 0 =>
364
362
EmptyTree
365
363
case tree : DefDef if tree.symbol.is(Macro ) && level == 0 =>
366
- tree // Do nothin in this phase
364
+ tree // Do nothing in this phase
367
365
case _ =>
368
366
markDef(tree)
369
367
mapOverTree(enteredSyms)
0 commit comments