@@ -1077,6 +1077,13 @@ object Trees {
1077
1077
/** Hook to indicate that a transform of some subtree should be skipped */
1078
1078
protected def skipTransform (tree : Tree )(implicit ctx : Context ): Boolean = false
1079
1079
1080
+ /** For untyped trees, this is just the identity.
1081
+ * For typed trees, a context derived form `ctx` that records `call` as the
1082
+ * innermost enclosing call for which the inlined version is currently
1083
+ * processed.
1084
+ */
1085
+ protected def inlineContext (call : Tree )(implicit ctx : Context ): Context = ctx
1086
+
1080
1087
abstract class TreeMap (val cpy : TreeCopier = inst.cpy) {
1081
1088
1082
1089
def transform (tree : Tree )(implicit ctx : Context ): Tree =
@@ -1121,7 +1128,7 @@ object Trees {
1121
1128
case SeqLiteral (elems, elemtpt) =>
1122
1129
cpy.SeqLiteral (tree)(transform(elems), transform(elemtpt))
1123
1130
case Inlined (call, bindings, expansion) =>
1124
- cpy.Inlined (tree)(call, transformSub(bindings), transform(expansion))
1131
+ cpy.Inlined (tree)(call, transformSub(bindings), transform(expansion)(inlineContext(call)) )
1125
1132
case TypeTree () =>
1126
1133
tree
1127
1134
case SingletonTypeTree (ref) =>
@@ -1225,7 +1232,7 @@ object Trees {
1225
1232
case SeqLiteral (elems, elemtpt) =>
1226
1233
this (this (x, elems), elemtpt)
1227
1234
case Inlined (call, bindings, expansion) =>
1228
- this (this (x, bindings), expansion)
1235
+ this (this (x, bindings), expansion)(inlineContext(call))
1229
1236
case TypeTree () =>
1230
1237
x
1231
1238
case SingletonTypeTree (ref) =>
0 commit comments