Skip to content

Commit 8f0271c

Browse files
committed
Get rid of ExceptionHandlerSel.
It's not used anymore as superseded by previous commit.
1 parent e7961f2 commit 8f0271c

File tree

4 files changed

+2
-20
lines changed

4 files changed

+2
-20
lines changed

src/dotty/tools/dotc/ast/Trees.scala

+1-4
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ object Trees {
804804
type ThisTree[-T >: Untyped] = Thicket[T]
805805
override def isEmpty: Boolean = trees.isEmpty
806806
override def toList: List[Tree[T]] = flatten(trees)
807-
override def toString = if(this eq theExceptionHandlerSel) "ExceptionSel" else if (isEmpty) "EmptyTree" else "Thicket(" + trees.mkString(", ") + ")"
807+
override def toString = if (isEmpty) "EmptyTree" else "Thicket(" + trees.mkString(", ") + ")"
808808
override def withPos(pos: Position): this.type = {
809809
val newTrees = trees.map(_.withPos(pos))
810810
new Thicket[T](newTrees).asInstanceOf[this.type]
@@ -818,11 +818,9 @@ object Trees {
818818

819819
val theEmptyTree: Thicket[Type] = Thicket(Nil)
820820
val theEmptyValDef = new EmptyValDef[Type]
821-
val theExceptionHandlerSel: Thicket[Type] = Thicket(Nil)
822821

823822
def genericEmptyValDef[T >: Untyped]: ValDef[T] = theEmptyValDef.asInstanceOf[ValDef[T]]
824823
def genericEmptyTree[T >: Untyped]: Thicket[T] = theEmptyTree.asInstanceOf[Thicket[T]]
825-
def genericExceptionHandlerSel[T >: Untyped]: Thicket[T] = theExceptionHandlerSel.asInstanceOf[Thicket[T]]
826824

827825
def flatten[T >: Untyped](trees: List[Tree[T]]): List[Tree[T]] = {
828826
var buf: ListBuffer[Tree[T]] = null
@@ -913,7 +911,6 @@ object Trees {
913911
type Thicket = Trees.Thicket[T]
914912

915913
val EmptyTree: Thicket = genericEmptyTree
916-
val ExceptionHandlerSel: Thicket = genericExceptionHandlerSel // selector used in exception hanlder of Try nodes
917914
val EmptyValDef: ValDef = genericEmptyValDef
918915

919916
// ----- Auxiliary creation methods ------------------

src/dotty/tools/dotc/transform/PatternMatcher.scala

+1-3
Original file line numberDiff line numberDiff line change
@@ -1139,9 +1139,7 @@ class PatternMatcher extends MiniPhaseTransform with DenotTransformer {thisTrans
11391139

11401140
val selectorTp = elimAnonymousClass(sel.tpe.widen/*withoutAnnotations*/)
11411141

1142-
val selectorSym =
1143-
if (sel ne ExceptionHandlerSel) freshSym(sel.pos, selectorTp, "selector")
1144-
else freshSym(match_.pos, defn.ThrowableType, "ex")
1142+
val selectorSym = freshSym(sel.pos, selectorTp, "selector")
11451143

11461144
val (nonSyntheticCases, defaultOverride) = cases match {
11471145
case init :+ last if isSyntheticDefaultCase(last) => (init, Some(((scrut: Symbol) => last.body)))

src/dotty/tools/dotc/transform/TailRec.scala

-11
Original file line numberDiff line numberDiff line change
@@ -231,17 +231,6 @@ class TailRec extends MiniPhaseTransform with DenotTransformer with FullParamete
231231
}
232232

233233
def rewriteTry(tree: Try): Try = {
234-
def transformHandlers(t: Tree): Tree = {
235-
t match {
236-
case Block(List((d: DefDef)), cl@Closure(Nil, _, EmptyTree)) =>
237-
val newDef = cpy.DefDef(d)(rhs = transform(d.rhs))
238-
Block(List(newDef), cl)
239-
case Match(Typed(ExceptionHandlerSel, _), _) =>
240-
transform(t)
241-
case _: Ident|_: Apply| _: TypeApply => t // handler is an external function
242-
case _ => assert(false, s"failed to deconstruct try handler ${t.show}"); ???
243-
}
244-
}
245234
if (tree.finalizer eq EmptyTree) {
246235
// SI-1672 Catches are in tail position when there is no finalizer
247236
tpd.cpy.Try(tree)(

src/dotty/tools/dotc/typer/Typer.scala

-2
Original file line numberDiff line numberDiff line change
@@ -345,8 +345,6 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
345345
assignType(cpy.Typed(tree)(expr1, tpt1), tpt1)
346346
}
347347
tree.expr match {
348-
case ExceptionHandlerSel if (tree.tpt.tpe == defn.ThrowableType) =>
349-
tree withType defn.ThrowableType
350348
case id: untpd.Ident if (ctx.mode is Mode.Pattern) && isVarPattern(id) =>
351349
if (id.name == nme.WILDCARD) regularTyped(isWildcard = true)
352350
else {

0 commit comments

Comments
 (0)