Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4b81c19

Browse files
committedJan 13, 2019
Remove levelOf from ReifyQuotes
1 parent 1a44aa6 commit 4b81c19

File tree

1 file changed

+2
-9
lines changed

1 file changed

+2
-9
lines changed
 

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

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,6 @@ class ReifyQuotes extends MacroTransformWithImplicits {
8080
new Reifier(inQuote = false, null, 0, new LevelInfo, new Embedded, ctx)
8181

8282
private class LevelInfo {
83-
/** A map from locally defined symbols to the staging levels of their definitions */
84-
val levelOf = new mutable.HashMap[Symbol, Int]
8583

8684
/** Register a reference defined in a quote but used in another quote nested in a splice.
8785
* Returns a version of the reference that needs to be used in its place.
@@ -119,9 +117,6 @@ class ReifyQuotes extends MacroTransformWithImplicits {
119117
val nestedEmbedded = if (level > 1 || (level == 1 && isQuote)) embedded else new Embedded
120118
new Reifier(isQuote, this, if (isQuote) level + 1 else level - 1, levels, nestedEmbedded, ctx)
121119
}
122-
//
123-
// /** We are in a `~(...)` context that is not shadowed by a nested `'(...)` */
124-
// def inSplice: Boolean = outer != null && !inQuote
125120

126121
/** A stack of entered symbols, to be unwound after scope exit */
127122
var enteredSyms: List[Symbol] = Nil
@@ -130,8 +125,7 @@ class ReifyQuotes extends MacroTransformWithImplicits {
130125
def markDef(tree: Tree)(implicit ctx: Context): Unit = tree match {
131126
case tree: DefTree =>
132127
val sym = tree.symbol
133-
if ((sym.isClass || !sym.maybeOwner.isType) && !levelOf.contains(sym)) {
134-
levelOf(sym) = level
128+
if ((sym.isClass || !sym.maybeOwner.isType)) {
135129
enteredSyms = sym :: enteredSyms
136130
}
137131
case _ =>
@@ -311,7 +305,7 @@ class ReifyQuotes extends MacroTransformWithImplicits {
311305

312306
/** Returns true if this tree will be captured by `makeLambda`. Checks phase consistency and presence of capturer. */
313307
private def isCaptured(sym: Symbol, level: Int)(implicit ctx: Context): Boolean =
314-
level == 1 && levelOf.get(sym).contains(1) && capturers.contains(sym)
308+
level == 1 && capturers.contains(sym)
315309

316310
/** Transform `tree` and return the resulting tree and all `embedded` quotes
317311
* or splices as a pair, after performing the `addTags` transform.
@@ -335,7 +329,6 @@ class ReifyQuotes extends MacroTransformWithImplicits {
335329
try super.transform(tree)
336330
finally
337331
while (enteredSyms ne lastEntered) {
338-
levelOf -= enteredSyms.head
339332
enteredSyms = enteredSyms.tail
340333
}
341334
tree match {

0 commit comments

Comments
 (0)