@@ -102,15 +102,11 @@ class DropBreaks extends MiniPhase:
102
102
103
103
/** `(local, arg)` provided `tree` matches inlined
104
104
*
105
- * val Label_this: ... = local
106
- * throw new Break[...](Label_this, arg)
105
+ * throw new Break[...](local, arg): Nothing
107
106
*/
108
107
def unapply (tree : Tree )(using Context ): Option [(Symbol , Tree )] = tree match
109
- case Inlined (_,
110
- (vd @ ValDef (label_this1, _, id : Ident )):: Nil ,
111
- Apply (throww, Apply (constr, Inlined (_, _, Ident (label_this2)) :: arg :: Nil ) :: Nil ))
108
+ case Apply (throww, Apply (constr, Inlined (_, _, id : Ident ) :: arg :: Nil ) :: Nil )
112
109
if throww.symbol == defn.throwMethod
113
- && label_this1 == nme.Label_this && label_this2 == nme.Label_this
114
110
&& id.symbol.name == nme.local
115
111
&& constr.symbol.isClassConstructor && constr.symbol.owner == defn.BreakClass =>
116
112
Some ((id.symbol, arg))
@@ -168,20 +164,18 @@ class DropBreaks extends MiniPhase:
168
164
169
165
/** Rewrite a BreakThrow
170
166
*
171
- * val Label_this: ... = local
172
- * throw new Break[...](Label_this, arg)
167
+ * throw new Break[...](local, arg)
173
168
*
174
169
* where `local` is defined in the current method and is not included in
175
- * LabeldShowedByTry to
170
+ * LabeledShowedByTry to
176
171
*
177
172
* return[target] arg
178
173
*
179
174
* where `target` is the `goto` return label associated with `local`.
180
175
* Adjust associated ref counts accordingly. The local refcount is increased
181
- * and the non-local refcount is decreased, since `local` the `Label_this`
182
- * binding containing `local` is dropped.
176
+ * and the non-local refcount is decreased.
183
177
*/
184
- override def transformInlined (tree : Inlined )(using Context ): Tree = tree match
178
+ override def transformApply (tree : Apply )(using Context ): Tree = tree match
185
179
case BreakThrow (lbl, arg) =>
186
180
report.log(i " trans inlined $arg, ${arg.source}, ${ctx.outer.source}, ${tree.source}" )
187
181
labelUsage(lbl) match
@@ -191,10 +185,7 @@ class DropBreaks extends MiniPhase:
191
185
=>
192
186
uses.otherRefs -= 1
193
187
uses.returnRefs += 1
194
- cpy.Inlined (tree)(tree.call, Nil ,
195
- inContext(ctx.withSource(tree.expansion.source)) {
196
- Return (arg, ref(uses.goto)).withSpan(arg.span)
197
- })
188
+ Return (arg, ref(uses.goto)).withSpan(arg.span)
198
189
case _ =>
199
190
tree
200
191
case _ =>
0 commit comments