Skip to content

Commit 95c247d

Browse files
committed
Remove Throw custom extractor
1 parent ac0a0c1 commit 95c247d

File tree

3 files changed

+4
-18
lines changed

3 files changed

+4
-18
lines changed

compiler/src/dotty/tools/backend/jvm/BCodeBodyBuilder.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,8 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
307307
case t @ Try(_, _, _) =>
308308
generatedType = genLoadTry(t)
309309

310-
case ThrowBI(expr) =>
311-
generatedType = genThrow(expr)
310+
case t: Apply if t.fun.symbol eq defn.throwMethod =>
311+
generatedType = genThrow(t.args.head)
312312

313313
case New(tpt) =>
314314
abort(s"Unexpected New(${tpt.tpe.showSummary()}/$tpt) reached GenBCode.\n" +

compiler/src/dotty/tools/backend/jvm/BCodeSkelBuilder.scala

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,8 @@ trait BCodeSkelBuilder extends BCodeHelpers {
584584
genLoad(rhs, returnType)
585585

586586
rhs match {
587-
case (_: Return) | Block(_, (_: Return)) | ThrowBI(_) | Block(_, ThrowBI(_)) => ()
587+
case (_: Return) | Block(_, (_: Return)) => ()
588+
case (_: Apply) | Block(_, (_: Apply)) if rhs.symbol eq defn.throwMethod => ()
588589
case tpd.EmptyTree =>
589590
ctx.error("Concrete method has no definition: " + dd + (
590591
if (ctx.settings.Ydebug.value) "(found: " + methSymbol.owner.info.decls.toList.mkString(", ") + ")"

compiler/src/dotty/tools/backend/jvm/DottyBackendInterface.scala

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -139,21 +139,6 @@ class DottyBackendInterface(val outputDirectory: AbstractFile, val superCallsMap
139139
}
140140
}
141141

142-
object ThrowBI {
143-
var field: tpd.Apply = _
144-
def isEmpty: Boolean = field eq null
145-
def isDefined = !isEmpty
146-
def get: Tree = field.args.head
147-
def unapply(s: tpd.Apply): ThrowBI.type = {
148-
if (s.fun.symbol eq defn.throwMethod) {
149-
field = s
150-
} else {
151-
field = null
152-
}
153-
this
154-
}
155-
}
156-
157142
object ArrayValueBI extends DeconstructorCommon[tpd.JavaSeqLiteral] {
158143
def _1: Type = field.tpe match {
159144
case JavaArrayType(elem) => elem

0 commit comments

Comments
 (0)