@@ -533,17 +533,16 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
533
533
}
534
534
}
535
535
536
- private def genLabelDef (lblDf : LabelDef , expectedType : BType , jumpTo : asm. Label = null ): Unit = lblDf match {
536
+ private def genLabelDef (lblDf : LabelDef , expectedType : BType ): Unit = lblDf match {
537
537
case LabelDef (_, _, rhs) =>
538
+
539
+ assert(int.hasLabelDefs) // scalac
540
+
538
541
// duplication of LabelDefs contained in `finally`-clauses is handled when emitting RETURN. No bookkeeping for that required here.
539
542
// no need to call index() over lblDf.params, on first access that magic happens (moreover, no LocalVariableTable entries needed for them).
540
543
markProgramPoint(programPoint(lblDf.symbol))
541
544
lineNumber(lblDf)
542
545
genLoad(rhs, expectedType)
543
- if (jumpTo ne null ) { // dotty
544
- bc goTo jumpTo
545
- }
546
- else assert(! int.shouldEmitJumpAfterLabels) // scalac
547
546
}
548
547
549
548
private def genLabeled (tree : Labeled ): BType = tree match {
@@ -776,6 +775,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
776
775
val sym = fun.symbol
777
776
778
777
if (sym.isLabel) { // jump to a label
778
+ assert(int.hasLabelDefs)
779
779
genLoadLabelArguments(args, labelDef(sym), app.pos)
780
780
bc goTo programPoint(sym)
781
781
} else if (isPrimitive(fun)) { // primitive method call
@@ -924,44 +924,18 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
924
924
def genBlock (tree : Block , expectedType : BType ) = tree match {
925
925
case Block (stats, expr) =>
926
926
927
-
928
- def genNormalBlock = {
929
- val savedScope = varsInScope
930
- varsInScope = Nil
931
- stats foreach genStat
932
- genLoad(expr, expectedType)
933
- val end = currProgramPoint()
934
- if (emitVars) {
935
- // add entries to LocalVariableTable JVM attribute
936
- for ((sym, start) <- varsInScope.reverse) {
937
- emitLocalVarScope(sym, start, end)
938
- }
939
- }
940
- varsInScope = savedScope
941
- }
942
-
943
- if (! int.shouldEmitJumpAfterLabels) genNormalBlock
944
- else {
945
- val (prefixLabels : List [LabelDef ] @ unchecked, stats1) = stats.span {
946
- case t@ LabelDef (_, _, _) => true
947
- case _ => false
948
- }
949
- assert(stats1.isEmpty || prefixLabels.isEmpty)
950
- if (! prefixLabels.isEmpty) {
951
- val startLocation = new asm.Label
952
- val breakLocation = new asm.Label
953
- bc goTo startLocation
954
- prefixLabels.foreach{ lblDf => labelDef.+= (lblDf.symbol -> lblDf)}
955
- prefixLabels.foreach{ lblDf => genLabelDef(lblDf, tpeTK(lblDf), breakLocation)}
956
- markProgramPoint(startLocation)
957
- val generated = tpeTK(expr)
958
- genLoad(expr, generated)
959
- markProgramPoint(breakLocation)
960
- if (generated != expectedType)
961
- adapt(generated, expectedType)
927
+ val savedScope = varsInScope
928
+ varsInScope = Nil
929
+ stats foreach genStat
930
+ genLoad(expr, expectedType)
931
+ val end = currProgramPoint()
932
+ if (emitVars) {
933
+ // add entries to LocalVariableTable JVM attribute
934
+ for ((sym, start) <- varsInScope.reverse) {
935
+ emitLocalVarScope(sym, start, end)
962
936
}
963
- else genNormalBlock
964
937
}
938
+ varsInScope = savedScope
965
939
}
966
940
967
941
def adapt (from : BType , to : BType ): Unit = {
0 commit comments