@@ -53,9 +53,9 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
53
53
54
54
/* ---------------- helper utils for generating methods and code ---------------- */
55
55
56
- def emit (opc : Int ) { mnode.visitInsn(opc) }
56
+ def emit (opc : Int ): Unit = { mnode.visitInsn(opc) }
57
57
58
- def emitZeroOf (tk : BType ) {
58
+ def emitZeroOf (tk : BType ): Unit = {
59
59
(tk.sort: @ switch) match {
60
60
case asm.Type .BOOLEAN => bc.boolconst(false )
61
61
case asm.Type .BYTE |
@@ -75,7 +75,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
75
75
* Two main cases: `tree` is an assignment,
76
76
* otherwise an `adapt()` to UNIT is performed if needed.
77
77
*/
78
- def genStat (tree : Tree ) {
78
+ def genStat (tree : Tree ): Unit = {
79
79
lineNumber(tree)
80
80
tree match {
81
81
case Assign (lhs @ Select (_, _), rhs) =>
@@ -341,12 +341,12 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
341
341
)
342
342
}
343
343
344
- def genLoad (tree : Tree ) {
344
+ def genLoad (tree : Tree ): Unit = {
345
345
genLoad(tree, tpeTK(tree))
346
346
}
347
347
348
348
/* Generate code for trees that produce values on the stack */
349
- def genLoad (tree : Tree , expectedType : BType ) {
349
+ def genLoad (tree : Tree , expectedType : BType ): Unit = {
350
350
var generatedType = expectedType
351
351
352
352
lineNumber(tree)
@@ -417,7 +417,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
417
417
debuglog(s " Host class of $sym with qual $qualifier ( ${qualifier.tpe}) is $hostClass" )
418
418
val qualSafeToElide = treeInfo isQualifierSafeToElide qualifier
419
419
420
- def genLoadQualUnlessElidable () { if (! qualSafeToElide) { genLoadQualifier(tree) } }
420
+ def genLoadQualUnlessElidable (): Unit = { if (! qualSafeToElide) { genLoadQualifier(tree) } }
421
421
422
422
if (sym is Flags .ModuleVal ) {
423
423
genLoadQualUnlessElidable()
@@ -482,20 +482,20 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
482
482
/*
483
483
* must-single-thread
484
484
*/
485
- def fieldLoad ( field : Symbol , hostClass : Symbol = null ) {
485
+ def fieldLoad ( field : Symbol , hostClass : Symbol = null ): Unit = {
486
486
fieldOp(field, isLoad = true , hostClass)
487
487
}
488
488
/*
489
489
* must-single-thread
490
490
*/
491
- def fieldStore (field : Symbol , hostClass : Symbol = null ) {
491
+ def fieldStore (field : Symbol , hostClass : Symbol = null ): Unit = {
492
492
fieldOp(field, isLoad = false , hostClass)
493
493
}
494
494
495
495
/*
496
496
* must-single-thread
497
497
*/
498
- private def fieldOp (field : Symbol , isLoad : Boolean , hostClass : Symbol ) {
498
+ private def fieldOp (field : Symbol , isLoad : Boolean , hostClass : Symbol ): Unit = {
499
499
// LOAD_FIELD.hostClass , CALL_METHOD.hostClass , and #4283
500
500
val owner =
501
501
if (hostClass == null ) internalName(field.owner)
@@ -517,7 +517,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
517
517
* must-single-thread
518
518
* Otherwise it's safe to call from multiple threads.
519
519
*/
520
- def genConstant (const : Constant ) {
520
+ def genConstant (const : Constant ): Unit = {
521
521
522
522
import dotc .core .Constants ._
523
523
@@ -566,15 +566,15 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
566
566
}
567
567
}
568
568
569
- private def genLabelDef (lblDf : LabelDef , expectedType : BType ) {
569
+ private def genLabelDef (lblDf : LabelDef , expectedType : BType ): Unit = {
570
570
// duplication of LabelDefs contained in `finally`-clauses is handled when emitting RETURN. No bookkeeping for that required here.
571
571
// no need to call index() over lblDf.params, on first access that magic happens (moreover, no LocalVariableTable entries needed for them).
572
572
markProgramPoint(programPoint(lblDf.symbol))
573
573
lineNumber(lblDf)
574
574
genLoad(lblDf.rhs, expectedType)
575
575
}
576
576
577
- private def genReturn (r : Return ) {
577
+ private def genReturn (r : Return ): Unit = {
578
578
val Return (expr) = r
579
579
val returnedKind = tpeTK(expr)
580
580
genLoad(expr, returnedKind)
@@ -736,7 +736,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
736
736
generatedType = genPrimitiveOp(app, expectedType)
737
737
} else { // normal method call
738
738
739
- def genNormalMethodCall () {
739
+ def genNormalMethodCall (): Unit = {
740
740
741
741
val invokeStyle =
742
742
if (sym.isStaticMember) icodes.opcodes.Static (onInstance = false )
@@ -871,7 +871,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
871
871
generatedType
872
872
}
873
873
874
- def genBlock (tree : Block , expectedType : BType ) {
874
+ def genBlock (tree : Block , expectedType : BType ): Unit = {
875
875
val Block (stats, expr) = tree
876
876
val savedScope = varsInScope
877
877
varsInScope = Nil
@@ -903,7 +903,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
903
903
}
904
904
905
905
/* Emit code to Load the qualifier of `tree` on top of the stack. */
906
- def genLoadQualifier (tree : Tree ) {
906
+ def genLoadQualifier (tree : Tree ): Unit = {
907
907
lineNumber(tree)
908
908
tree match {
909
909
case Select (qualifier, _) => genLoad(qualifier)
@@ -912,7 +912,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
912
912
}
913
913
914
914
/* Generate code that loads args into label parameters. */
915
- def genLoadLabelArguments (args : List [Tree ], lblDef : LabelDef , gotoPos : dotc.util.Positions .Position ) {
915
+ def genLoadLabelArguments (args : List [Tree ], lblDef : LabelDef , gotoPos : dotc.util.Positions .Position ): Unit = {
916
916
917
917
val aps = {
918
918
val params : List [Symbol ] = lblDef.params.map(_.symbol)
@@ -940,7 +940,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
940
940
941
941
}
942
942
943
- def genLoadArguments (args : List [Tree ], btpes : List [BType ]) {
943
+ def genLoadArguments (args : List [Tree ], btpes : List [BType ]): Unit = {
944
944
(args zip btpes) foreach { case (arg, btpe) => genLoad(arg, btpe) }
945
945
}
946
946
@@ -957,7 +957,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
957
957
symInfoTK(module)
958
958
}
959
959
960
- def genLoadModule (module : Symbol ) {
960
+ def genLoadModule (module : Symbol ): Unit = {
961
961
def inStaticMethod = methSymbol != null && methSymbol.isStaticMember
962
962
if (claszSymbol == module.moduleClass && jMethodName != " readResolve" && ! inStaticMethod) {
963
963
mnode.visitVarInsn(asm.Opcodes .ALOAD , 0 )
@@ -972,15 +972,15 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
972
972
}
973
973
}
974
974
975
- def genConversion (from : BType , to : BType , cast : Boolean ) {
975
+ def genConversion (from : BType , to : BType , cast : Boolean ): Unit = {
976
976
if (cast) { bc.emitT2T(from, to) }
977
977
else {
978
978
bc drop from
979
979
bc boolconst (from == to)
980
980
}
981
981
}
982
982
983
- def genCast (to : BType , cast : Boolean ) {
983
+ def genCast (to : BType , cast : Boolean ): Unit = {
984
984
if (cast) { bc checkCast to }
985
985
else { bc isInstance to }
986
986
}
@@ -989,7 +989,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
989
989
def isPrimitive (fun : Symbol ): Boolean = scalaPrimitives.isPrimitive(fun)
990
990
991
991
/* Generate coercion denoted by "code" */
992
- def genCoercion (code : Int ) {
992
+ def genCoercion (code : Int ): Unit = {
993
993
import scalaPrimitives ._
994
994
(code : @ switch) match {
995
995
case B2B | S2S | C2C | I2I | L2L | F2F | D2D => ()
@@ -1053,7 +1053,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
1053
1053
val bmType = asmMethodType(method)
1054
1054
val mdescr = bmType.getDescriptor
1055
1055
1056
- def initModule () {
1056
+ def initModule (): Unit = {
1057
1057
// we initialize the MODULE$ field immediately after the super ctor
1058
1058
if (! isModuleInitialized &&
1059
1059
jMethodName == INSTANCE_CONSTRUCTOR_NAME &&
@@ -1122,7 +1122,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
1122
1122
def ifOneIsNull (l : Tree , r : Tree ) = if (isNull(l)) r else if (isNull(r)) l else null
1123
1123
1124
1124
/* Emit code to compare the two top-most stack values using the 'op' operator. */
1125
- private def genCJUMP (success : asm.Label , failure : asm.Label , op : TestOp , tk : BType ) {
1125
+ private def genCJUMP (success : asm.Label , failure : asm.Label , op : TestOp , tk : BType ): Unit = {
1126
1126
if (tk.isIntSizedType) { // BOOL, BYTE, CHAR, SHORT, or INT
1127
1127
bc.emitIF_ICMP(op, success)
1128
1128
} else if (tk.isRefOrArrayType) { // REFERENCE(_) | ARRAY(_)
@@ -1143,7 +1143,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
1143
1143
}
1144
1144
1145
1145
/* Emits code to compare (and consume) stack-top and zero using the 'op' operator */
1146
- private def genCZJUMP (success : asm.Label , failure : asm.Label , op : TestOp , tk : BType ) {
1146
+ private def genCZJUMP (success : asm.Label , failure : asm.Label , op : TestOp , tk : BType ): Unit = {
1147
1147
if (tk.isIntSizedType) { // BOOL, BYTE, CHAR, SHORT, or INT
1148
1148
bc.emitIF(op, success)
1149
1149
} else if (tk.isRefOrArrayType) { // REFERENCE(_) | ARRAY(_)
@@ -1179,9 +1179,9 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
1179
1179
* Generate code for conditional expressions.
1180
1180
* The jump targets success/failure of the test are `then-target` and `else-target` resp.
1181
1181
*/
1182
- private def genCond (tree : Tree , success : asm.Label , failure : asm.Label ) {
1182
+ private def genCond (tree : Tree , success : asm.Label , failure : asm.Label ): Unit = {
1183
1183
1184
- def genComparisonOp (l : Tree , r : Tree , code : Int ) {
1184
+ def genComparisonOp (l : Tree , r : Tree , code : Int ): Unit = {
1185
1185
val op : TestOp = testOpForPrimitive(code - scalaPrimitives.ID )
1186
1186
// special-case reference (in)equality test for null (null eq x, x eq null)
1187
1187
var nonNullSide : Tree = null
@@ -1214,7 +1214,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
1214
1214
lazy val Select (lhs, _) = fun
1215
1215
val rhs = if (args.isEmpty) EmptyTree else args.head; // args.isEmpty only for ZNOT
1216
1216
1217
- def genZandOrZor (and : Boolean ) { // TODO WRONG
1217
+ def genZandOrZor (and : Boolean ): Unit = { // TODO WRONG
1218
1218
// reaching "keepGoing" indicates the rhs should be evaluated too (ie not short-circuited).
1219
1219
val keepGoing = new asm.Label
1220
1220
@@ -1254,7 +1254,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
1254
1254
* @param l left-hand-side of the '=='
1255
1255
* @param r right-hand-side of the '=='
1256
1256
*/
1257
- def genEqEqPrimitive (l : Tree , r : Tree , success : asm.Label , failure : asm.Label ) {
1257
+ def genEqEqPrimitive (l : Tree , r : Tree , success : asm.Label , failure : asm.Label ): Unit = {
1258
1258
1259
1259
/* True if the equality comparison is between values that require the use of the rich equality
1260
1260
* comparator (scala.runtime.Comparator.equals). This is the case when either side of the
0 commit comments