@@ -15,12 +15,6 @@ import scala.collection.mutable
15
15
abstract class TreeMapWithStages extends TreeMapWithImplicits {
16
16
import tpd ._
17
17
18
- /** If we are inside a quote or a splice */
19
- private [this ] var inQuoteOrSplice = false
20
-
21
- /** If we are inside a quote or a splice */
22
- protected def isInQuoteOrSplice : Boolean = inQuoteOrSplice
23
-
24
18
/** Transform the quote `quote` which contains the quoted `body`.
25
19
*
26
20
* - `quoted.runtime.Expr.quote[T](<body0>)` --> `quoted.runtime.Expr.quote[T](<body>)`
@@ -53,41 +47,28 @@ abstract class TreeMapWithStages extends TreeMapWithImplicits {
53
47
54
48
tree match {
55
49
case tree @ QuotedTypeOf (quotedTree) =>
56
- val old = inQuoteOrSplice
57
- inQuoteOrSplice = true
58
- try transformQuotedType(quotedTree, tree)
59
- finally inQuoteOrSplice = old
60
-
50
+ transformQuotedType(quotedTree, tree)
61
51
case tree @ Quote (quotedTree) =>
62
- val old = inQuoteOrSplice
63
- inQuoteOrSplice = true
64
- try dropEmptyBlocks(quotedTree) match {
52
+ dropEmptyBlocks(quotedTree) match {
65
53
case Splice (t) =>
66
54
// Optimization: `'{ $x }` --> `x`
67
55
// and adapt the refinement of `Quotes { type reflect: ... } ?=> Expr[T]`
68
56
transform(t).asInstance(tree.tpe)
69
57
case _ =>
70
58
transformQuote(quotedTree, tree)
71
59
}
72
- finally inQuoteOrSplice = old
73
60
74
61
case tree @ Splice (splicedTree) =>
75
- val old = inQuoteOrSplice
76
- inQuoteOrSplice = true
77
- try dropEmptyBlocks(splicedTree) match {
62
+ dropEmptyBlocks(splicedTree) match {
78
63
case Quote (t) =>
79
64
// Optimization: `${ 'x }` --> `x`
80
65
transform(t)
81
66
case _ =>
82
67
transformSplice(splicedTree, tree)
83
68
}
84
- finally inQuoteOrSplice = old
85
69
86
70
case tree @ SplicedType (splicedTree) =>
87
- val old = inQuoteOrSplice
88
- inQuoteOrSplice = true
89
- try transformSpliceType(splicedTree, tree)
90
- finally inQuoteOrSplice = old
71
+ transformSpliceType(splicedTree, tree)
91
72
92
73
case Block (stats, _) =>
93
74
val defSyms = stats.collect { case defTree : DefTree => defTree.symbol }
0 commit comments