@@ -45,9 +45,9 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
45
45
46
46
/* ---------------- helper utils for generating methods and code ---------------- */
47
47
48
- def emit (opc : Int ) { mnode.visitInsn(opc) }
48
+ def emit (opc : Int ): Unit = { mnode.visitInsn(opc) }
49
49
50
- def emitZeroOf (tk : BType ) {
50
+ def emitZeroOf (tk : BType ): Unit = {
51
51
tk match {
52
52
case BOOL => bc.boolconst(false )
53
53
case BYTE |
@@ -67,7 +67,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
67
67
* Two main cases: `tree` is an assignment,
68
68
* otherwise an `adapt()` to UNIT is performed if needed.
69
69
*/
70
- def genStat (tree : Tree ) {
70
+ def genStat (tree : Tree ): Unit = {
71
71
lineNumber(tree)
72
72
73
73
tree match {
@@ -264,12 +264,12 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
264
264
)
265
265
}
266
266
267
- def genLoad (tree : Tree ) {
267
+ def genLoad (tree : Tree ): Unit = {
268
268
genLoad(tree, tpeTK(tree))
269
269
}
270
270
271
271
/* Generate code for trees that produce values on the stack */
272
- def genLoad (tree : Tree , expectedType : BType ) {
272
+ def genLoad (tree : Tree , expectedType : BType ): Unit = {
273
273
var generatedType = expectedType
274
274
275
275
lineNumber(tree)
@@ -363,7 +363,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
363
363
debuglog(s " Host class of $sym with qual $qualifier ( ${qualifier.tpe}) is $hostClass" )
364
364
val qualSafeToElide = isQualifierSafeToElide(qualifier)
365
365
366
- def genLoadQualUnlessElidable () { if (! qualSafeToElide) { genLoadQualifier(tree) } }
366
+ def genLoadQualUnlessElidable (): Unit = { if (! qualSafeToElide) { genLoadQualifier(tree) } }
367
367
368
368
if (sym.isModule) {
369
369
genLoadQualUnlessElidable()
@@ -442,20 +442,20 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
442
442
/*
443
443
* must-single-thread
444
444
*/
445
- def fieldLoad ( field : Symbol , hostClass : Symbol = null ) {
445
+ def fieldLoad ( field : Symbol , hostClass : Symbol = null ): Unit = {
446
446
fieldOp(field, isLoad = true , hostClass)
447
447
}
448
448
/*
449
449
* must-single-thread
450
450
*/
451
- def fieldStore (field : Symbol , hostClass : Symbol = null ) {
451
+ def fieldStore (field : Symbol , hostClass : Symbol = null ): Unit = {
452
452
fieldOp(field, isLoad = false , hostClass)
453
453
}
454
454
455
455
/*
456
456
* must-single-thread
457
457
*/
458
- private def fieldOp (field : Symbol , isLoad : Boolean , hostClass : Symbol ) {
458
+ private def fieldOp (field : Symbol , isLoad : Boolean , hostClass : Symbol ): Unit = {
459
459
// LOAD_FIELD.hostClass , CALL_METHOD.hostClass , and #4283
460
460
val owner =
461
461
if (hostClass == null ) internalName(field.owner)
@@ -477,7 +477,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
477
477
* must-single-thread
478
478
* Otherwise it's safe to call from multiple threads.
479
479
*/
480
- def genConstant (const : Constant ) {
480
+ def genConstant (const : Constant ): Unit = {
481
481
(const.tag: @ switch) match {
482
482
483
483
case BooleanTag => bc.boolconst(const.booleanValue)
@@ -711,7 +711,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
711
711
generatedType = genPrimitiveOp(app, expectedType)
712
712
} else { // normal method call
713
713
714
- def genNormalMethodCall () {
714
+ def genNormalMethodCall (): Unit = {
715
715
716
716
val invokeStyle =
717
717
if (sym.isStaticMember) Opcodes .Static (onInstance = false )
@@ -893,7 +893,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
893
893
}
894
894
}
895
895
896
- def adapt (from : BType , to : BType ) {
896
+ def adapt (from : BType , to : BType ): Unit = {
897
897
if (! from.conformsTo(to)) {
898
898
to match {
899
899
case UNIT => bc drop from
@@ -956,7 +956,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
956
956
}
957
957
958
958
/* Emit code to Load the qualifier of `tree` on top of the stack. */
959
- def genLoadQualifier (tree : Tree ) {
959
+ def genLoadQualifier (tree : Tree ): Unit = {
960
960
lineNumber(tree)
961
961
tree match {
962
962
case Select (qualifier, _) => genLoad(qualifier)
@@ -1000,7 +1000,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
1000
1000
1001
1001
}
1002
1002
1003
- def genLoadArguments (args : List [Tree ], btpes : List [BType ]) {
1003
+ def genLoadArguments (args : List [Tree ], btpes : List [BType ]): Unit = {
1004
1004
(args zip btpes) foreach { case (arg, btpe) => genLoad(arg, btpe) }
1005
1005
}
1006
1006
@@ -1017,7 +1017,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
1017
1017
symInfoTK(module)
1018
1018
}
1019
1019
1020
- def genLoadModule (module : Symbol ) {
1020
+ def genLoadModule (module : Symbol ): Unit = {
1021
1021
def inStaticMethod = methSymbol != null && methSymbol.isStaticMember
1022
1022
if (claszSymbol == module.moduleClass && jMethodName != " readResolve" && ! inStaticMethod) {
1023
1023
mnode.visitVarInsn(asm.Opcodes .ALOAD , 0 )
@@ -1032,15 +1032,15 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
1032
1032
}
1033
1033
}
1034
1034
1035
- def genConversion (from : BType , to : BType , cast : Boolean ) {
1035
+ def genConversion (from : BType , to : BType , cast : Boolean ): Unit = {
1036
1036
if (cast) { bc.emitT2T(from, to) }
1037
1037
else {
1038
1038
bc drop from
1039
1039
bc boolconst (from == to)
1040
1040
}
1041
1041
}
1042
1042
1043
- def genCast (to : RefBType , cast : Boolean ) {
1043
+ def genCast (to : RefBType , cast : Boolean ): Unit = {
1044
1044
if (cast) { bc checkCast to }
1045
1045
else { bc isInstance to }
1046
1046
}
@@ -1051,7 +1051,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
1051
1051
}
1052
1052
1053
1053
/* Generate coercion denoted by "code" */
1054
- def genCoercion (code : Int ) {
1054
+ def genCoercion (code : Int ): Unit = {
1055
1055
import ScalaPrimitivesOps ._
1056
1056
(code : @ switch) match {
1057
1057
case B2B | S2S | C2C | I2I | L2L | F2F | D2D => ()
@@ -1085,7 +1085,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
1085
1085
StringReference
1086
1086
}
1087
1087
1088
- def genCallMethod (method : Symbol , style : InvokeStyle , hostClass0 : Symbol = null , pos : Position = NoPosition ) {
1088
+ def genCallMethod (method : Symbol , style : InvokeStyle , hostClass0 : Symbol = null , pos : Position = NoPosition ): Unit = {
1089
1089
1090
1090
val siteSymbol = claszSymbol
1091
1091
val hostSymbol = if (hostClass0 == null ) method.owner else hostClass0
@@ -1111,7 +1111,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
1111
1111
val bmType = asmMethodType(method)
1112
1112
val mdescr = bmType.descriptor
1113
1113
1114
- def initModule () {
1114
+ def initModule (): Unit = {
1115
1115
// we initialize the MODULE$ field immediately after the super ctor
1116
1116
if (! isModuleInitialized &&
1117
1117
jMethodName == INSTANCE_CONSTRUCTOR_NAME &&
@@ -1169,7 +1169,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
1169
1169
}
1170
1170
1171
1171
/* Emit code to compare the two top-most stack values using the 'op' operator. */
1172
- private def genCJUMP (success : asm.Label , failure : asm.Label , op : TestOp , tk : BType ) {
1172
+ private def genCJUMP (success : asm.Label , failure : asm.Label , op : TestOp , tk : BType ): Unit = {
1173
1173
if (tk.isIntSizedType) { // BOOL, BYTE, CHAR, SHORT, or INT
1174
1174
bc.emitIF_ICMP(op, success)
1175
1175
} else if (tk.isRef) { // REFERENCE(_) | ARRAY(_)
@@ -1191,7 +1191,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
1191
1191
}
1192
1192
1193
1193
/* Emits code to compare (and consume) stack-top and zero using the 'op' operator */
1194
- private def genCZJUMP (success : asm.Label , failure : asm.Label , op : TestOp , tk : BType ) {
1194
+ private def genCZJUMP (success : asm.Label , failure : asm.Label , op : TestOp , tk : BType ): Unit = {
1195
1195
import Primitives ._
1196
1196
1197
1197
if (tk.isIntSizedType) { // BOOL, BYTE, CHAR, SHORT, or INT
@@ -1234,9 +1234,9 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
1234
1234
* Generate code for conditional expressions.
1235
1235
* The jump targets success/failure of the test are `then-target` and `else-target` resp.
1236
1236
*/
1237
- private def genCond (tree : Tree , success : asm.Label , failure : asm.Label ) {
1237
+ private def genCond (tree : Tree , success : asm.Label , failure : asm.Label ): Unit = {
1238
1238
1239
- def genComparisonOp (l : Tree , r : Tree , code : Int ) {
1239
+ def genComparisonOp (l : Tree , r : Tree , code : Int ): Unit = {
1240
1240
val op : TestOp = testOpForPrimitive(code - ScalaPrimitivesOps .ID )
1241
1241
// special-case reference (in)equality test for null (null eq x, x eq null)
1242
1242
var nonNullSide : Tree = null
@@ -1269,7 +1269,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
1269
1269
lazy val Select (lhs, _) = fun
1270
1270
val rhs = if (args.isEmpty) EmptyTree else args.head; // args.isEmpty only for ZNOT
1271
1271
1272
- def genZandOrZor (and : Boolean ) { // TODO WRONG
1272
+ def genZandOrZor (and : Boolean ): Unit = { // TODO WRONG
1273
1273
// reaching "keepGoing" indicates the rhs should be evaluated too (ie not short-circuited).
1274
1274
val keepGoing = new asm.Label
1275
1275
@@ -1310,7 +1310,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
1310
1310
* @param l left-hand-side of the '=='
1311
1311
* @param r right-hand-side of the '=='
1312
1312
*/
1313
- def genEqEqPrimitive (l : Tree , r : Tree , success : asm.Label , failure : asm.Label ) {
1313
+ def genEqEqPrimitive (l : Tree , r : Tree , success : asm.Label , failure : asm.Label ): Unit = {
1314
1314
1315
1315
/* True if the equality comparison is between values that require the use of the rich equality
1316
1316
* comparator (scala.runtime.Comparator.equals). This is the case when either side of the
0 commit comments