@@ -93,31 +93,27 @@ class Staging extends MacroTransformWithImplicits {
93
93
if (ctx.compilationUnit.needsStaging) super .run
94
94
95
95
protected def newTransformer (implicit ctx : Context ): Transformer =
96
- new Reifier (inQuote = false , null , 0 , new LevelInfo , ctx )
96
+ new Reifier (0 , new LevelInfo )
97
97
98
98
private class LevelInfo {
99
99
/** A map from locally defined symbols to the staging levels of their definitions */
100
100
val levelOf = new mutable.HashMap [Symbol , Int ]
101
101
}
102
102
103
103
/** The main transformer class
104
- * @param inQuote we are within a `'(...)` context that is not shadowed by a nested `~(...)`
105
- * @param outer the next outer reifier, null is this is the topmost transformer
106
104
* @param level the current level, where quotes add one and splices subtract one level.
107
105
* The initial level is 0, a level `l` where `l > 0` implies code has been quoted `l` times
108
106
* and `l == -1` is code inside a top level splice (in an inline method).
109
107
* @param levels a stacked map from symbols to the levels in which they were defined
110
- * @param embedded a list of embedded quotes (if `inSplice = true`) or splices (if `inQuote = true`
111
- * @param rctx the contex in the destination lifted lambda
112
108
*/
113
- private class Reifier (inQuote : Boolean , val outer : Reifier , val level : Int , levels : LevelInfo , val rctx : Context )
109
+ private class Reifier (val level : Int , levels : LevelInfo )
114
110
extends ImplicitsTransformer {
115
111
import levels ._
116
112
assert(level >= - 1 )
117
113
118
114
/** A nested reifier for a quote (if `isQuote = true`) or a splice (if not) */
119
115
def nested (isQuote : Boolean )(implicit ctx : Context ): Reifier = {
120
- new Reifier (isQuote, this , if (isQuote) level + 1 else level - 1 , levels, ctx )
116
+ new Reifier (if (isQuote) level + 1 else level - 1 , levels)
121
117
}
122
118
123
119
/** A stack of entered symbols, to be unwound after scope exit */
@@ -212,14 +208,9 @@ class Staging extends MacroTransformWithImplicits {
212
208
def apply (tp : Type ): Type = reporting.trace(i " check type level $tp at $level" ) {
213
209
tp match {
214
210
case tp : TypeRef if tp.symbol.isSplice =>
215
- if (inQuote) {
216
- // TODO add level to checkType TypeMap and avoid accessing the outer one?
217
- outer.checkType(pos).mapOver(tp)
218
- }
219
- else {
220
- if (tp.isTerm) ctx.error(i " splice outside quotes " , pos)
211
+ if (tp.isTerm)
212
+ ctx.error(i " splice outside quotes " , pos)
221
213
tp
222
- }
223
214
case tp : NamedType =>
224
215
check(tp.symbol, tp, tp.symbol.sourcePos) match {
225
216
case Some (tpRef) => tpRef.tpe
0 commit comments