File tree 1 file changed +6
-4
lines changed
compiler/src/dotty/tools/dotc/typer
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -149,18 +149,20 @@ object Inliner {
149
149
150
150
/** Replace `Inlined` node by a block that contains its bindings and expansion */
151
151
def dropInlined (inlined : tpd.Inlined )(implicit ctx : Context ): Tree = {
152
- if (enclosingInlineds.nonEmpty) inlined // remove in the outer inlined call
152
+ if (enclosingInlineds.nonEmpty) inlined // Remove in the outer most inlined call
153
153
else {
154
+ /** Removes all Inlined trees, replacing them with blocks.
155
+ * Repositions all trees directly inside an inlined expantion of a non empty call to the position of the call.
156
+ * Any tree directly inside an empty call (inlined in the inlined code) retains their position.
157
+ */
154
158
class Reposition extends TreeMap {
155
159
override def transform (tree : Tree )(implicit ctx : Context ): Tree = {
156
160
tree match {
157
161
case tree : Inlined => transformInline(tree)
158
162
case _ =>
159
163
val transformed = super .transform(tree)
160
164
enclosingInlineds match {
161
- case call :: _ if ! call.isEmpty =>
162
- // This tree was inlined and will have the position of the call that was inlined
163
- transformed.withPos(call.pos)
165
+ case call :: _ if ! call.isEmpty => transformed.withPos(call.pos)
164
166
case _ => transformed
165
167
}
166
168
}
You can’t perform that action at this time.
0 commit comments