Skip to content

Commit c4979db

Browse files
committed
Fix emission of empty exception handlers in Dotty
Detection of any instructions were emitted wasn't robust enough, as it assumes that any ASM node would result in some byte code instruction being emmited. This is not true for LineNumber nodes and exploded with `ClassFormatError: Illegal exception Table range`
1 parent 3bcd390 commit c4979db

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,13 @@ trait BCodeSkelBuilder extends BCodeHelpers {
453453
if (!skip) { mnode visitLabel lbl }
454454
}
455455
def isAtProgramPoint(lbl: asm.Label): Boolean = {
456-
(lastInsn match { case labnode: asm.tree.LabelNode => (labnode.getLabel == lbl); case _ => false } )
456+
def getNonLineNumberNode(a: asm.tree.AbstractInsnNode): asm.tree.AbstractInsnNode = a match {
457+
case a: asm.tree.LineNumberNode => getNonLineNumberNode(a.getPrevious) // line numbers aren't part of code itself
458+
case _ => a
459+
}
460+
(getNonLineNumberNode(lastInsn) match {
461+
case labnode: asm.tree.LabelNode => (labnode.getLabel == lbl);
462+
case _ => false } )
457463
}
458464
def lineNumber(tree: Tree) {
459465
if (!emitLines || !tree.pos.isDefined) return;

0 commit comments

Comments
 (0)