Skip to content

Commit 6ce804d

Browse files
authored
Merge pull request scala#9 from smarter/proc-syntax
Rewrite usages of procedure syntax
2 parents d74e977 + d1334b4 commit 6ce804d

File tree

6 files changed

+105
-105
lines changed

6 files changed

+105
-105
lines changed

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

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
4545

4646
/* ---------------- helper utils for generating methods and code ---------------- */
4747

48-
def emit(opc: Int) { mnode.visitInsn(opc) }
48+
def emit(opc: Int): Unit = { mnode.visitInsn(opc) }
4949

50-
def emitZeroOf(tk: BType) {
50+
def emitZeroOf(tk: BType): Unit = {
5151
tk match {
5252
case BOOL => bc.boolconst(false)
5353
case BYTE |
@@ -67,7 +67,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
6767
* Two main cases: `tree` is an assignment,
6868
* otherwise an `adapt()` to UNIT is performed if needed.
6969
*/
70-
def genStat(tree: Tree) {
70+
def genStat(tree: Tree): Unit = {
7171
lineNumber(tree)
7272

7373
tree match {
@@ -264,12 +264,12 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
264264
)
265265
}
266266

267-
def genLoad(tree: Tree) {
267+
def genLoad(tree: Tree): Unit = {
268268
genLoad(tree, tpeTK(tree))
269269
}
270270

271271
/* 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 = {
273273
var generatedType = expectedType
274274

275275
lineNumber(tree)
@@ -363,7 +363,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
363363
debuglog(s"Host class of $sym with qual $qualifier (${qualifier.tpe}) is $hostClass")
364364
val qualSafeToElide = isQualifierSafeToElide(qualifier)
365365

366-
def genLoadQualUnlessElidable() { if (!qualSafeToElide) { genLoadQualifier(tree) } }
366+
def genLoadQualUnlessElidable(): Unit = { if (!qualSafeToElide) { genLoadQualifier(tree) } }
367367

368368
if (sym.isModule) {
369369
genLoadQualUnlessElidable()
@@ -442,20 +442,20 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
442442
/*
443443
* must-single-thread
444444
*/
445-
def fieldLoad( field: Symbol, hostClass: Symbol = null) {
445+
def fieldLoad( field: Symbol, hostClass: Symbol = null): Unit = {
446446
fieldOp(field, isLoad = true, hostClass)
447447
}
448448
/*
449449
* must-single-thread
450450
*/
451-
def fieldStore(field: Symbol, hostClass: Symbol = null) {
451+
def fieldStore(field: Symbol, hostClass: Symbol = null): Unit = {
452452
fieldOp(field, isLoad = false, hostClass)
453453
}
454454

455455
/*
456456
* must-single-thread
457457
*/
458-
private def fieldOp(field: Symbol, isLoad: Boolean, hostClass: Symbol) {
458+
private def fieldOp(field: Symbol, isLoad: Boolean, hostClass: Symbol): Unit = {
459459
// LOAD_FIELD.hostClass , CALL_METHOD.hostClass , and #4283
460460
val owner =
461461
if (hostClass == null) internalName(field.owner)
@@ -477,7 +477,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
477477
* must-single-thread
478478
* Otherwise it's safe to call from multiple threads.
479479
*/
480-
def genConstant(const: Constant) {
480+
def genConstant(const: Constant): Unit = {
481481
(const.tag: @switch) match {
482482

483483
case BooleanTag => bc.boolconst(const.booleanValue)
@@ -711,7 +711,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
711711
generatedType = genPrimitiveOp(app, expectedType)
712712
} else { // normal method call
713713

714-
def genNormalMethodCall() {
714+
def genNormalMethodCall(): Unit = {
715715

716716
val invokeStyle =
717717
if (sym.isStaticMember) Opcodes.Static(onInstance = false)
@@ -893,7 +893,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
893893
}
894894
}
895895

896-
def adapt(from: BType, to: BType) {
896+
def adapt(from: BType, to: BType): Unit = {
897897
if (!from.conformsTo(to)) {
898898
to match {
899899
case UNIT => bc drop from
@@ -956,7 +956,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
956956
}
957957

958958
/* Emit code to Load the qualifier of `tree` on top of the stack. */
959-
def genLoadQualifier(tree: Tree) {
959+
def genLoadQualifier(tree: Tree): Unit = {
960960
lineNumber(tree)
961961
tree match {
962962
case Select(qualifier, _) => genLoad(qualifier)
@@ -1000,7 +1000,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
10001000

10011001
}
10021002

1003-
def genLoadArguments(args: List[Tree], btpes: List[BType]) {
1003+
def genLoadArguments(args: List[Tree], btpes: List[BType]): Unit = {
10041004
(args zip btpes) foreach { case (arg, btpe) => genLoad(arg, btpe) }
10051005
}
10061006

@@ -1017,7 +1017,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
10171017
symInfoTK(module)
10181018
}
10191019

1020-
def genLoadModule(module: Symbol) {
1020+
def genLoadModule(module: Symbol): Unit = {
10211021
def inStaticMethod = methSymbol != null && methSymbol.isStaticMember
10221022
if (claszSymbol == module.moduleClass && jMethodName != "readResolve" && !inStaticMethod) {
10231023
mnode.visitVarInsn(asm.Opcodes.ALOAD, 0)
@@ -1032,15 +1032,15 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
10321032
}
10331033
}
10341034

1035-
def genConversion(from: BType, to: BType, cast: Boolean) {
1035+
def genConversion(from: BType, to: BType, cast: Boolean): Unit = {
10361036
if (cast) { bc.emitT2T(from, to) }
10371037
else {
10381038
bc drop from
10391039
bc boolconst (from == to)
10401040
}
10411041
}
10421042

1043-
def genCast(to: RefBType, cast: Boolean) {
1043+
def genCast(to: RefBType, cast: Boolean): Unit = {
10441044
if (cast) { bc checkCast to }
10451045
else { bc isInstance to }
10461046
}
@@ -1051,7 +1051,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
10511051
}
10521052

10531053
/* Generate coercion denoted by "code" */
1054-
def genCoercion(code: Int) {
1054+
def genCoercion(code: Int): Unit = {
10551055
import ScalaPrimitivesOps._
10561056
(code: @switch) match {
10571057
case B2B | S2S | C2C | I2I | L2L | F2F | D2D => ()
@@ -1085,7 +1085,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
10851085
StringReference
10861086
}
10871087

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 = {
10891089

10901090
val siteSymbol = claszSymbol
10911091
val hostSymbol = if (hostClass0 == null) method.owner else hostClass0
@@ -1111,7 +1111,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
11111111
val bmType = asmMethodType(method)
11121112
val mdescr = bmType.descriptor
11131113

1114-
def initModule() {
1114+
def initModule(): Unit = {
11151115
// we initialize the MODULE$ field immediately after the super ctor
11161116
if (!isModuleInitialized &&
11171117
jMethodName == INSTANCE_CONSTRUCTOR_NAME &&
@@ -1169,7 +1169,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
11691169
}
11701170

11711171
/* 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 = {
11731173
if (tk.isIntSizedType) { // BOOL, BYTE, CHAR, SHORT, or INT
11741174
bc.emitIF_ICMP(op, success)
11751175
} else if (tk.isRef) { // REFERENCE(_) | ARRAY(_)
@@ -1191,7 +1191,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
11911191
}
11921192

11931193
/* 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 = {
11951195
import Primitives._
11961196

11971197
if (tk.isIntSizedType) { // BOOL, BYTE, CHAR, SHORT, or INT
@@ -1234,9 +1234,9 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
12341234
* Generate code for conditional expressions.
12351235
* The jump targets success/failure of the test are `then-target` and `else-target` resp.
12361236
*/
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 = {
12381238

1239-
def genComparisonOp(l: Tree, r: Tree, code: Int) {
1239+
def genComparisonOp(l: Tree, r: Tree, code: Int): Unit = {
12401240
val op: TestOp = testOpForPrimitive(code - ScalaPrimitivesOps.ID)
12411241
// special-case reference (in)equality test for null (null eq x, x eq null)
12421242
var nonNullSide: Tree = null
@@ -1269,7 +1269,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
12691269
lazy val Select(lhs, _) = fun
12701270
val rhs = if (args.isEmpty) EmptyTree else args.head; // args.isEmpty only for ZNOT
12711271

1272-
def genZandOrZor(and: Boolean) { // TODO WRONG
1272+
def genZandOrZor(and: Boolean): Unit = { // TODO WRONG
12731273
// reaching "keepGoing" indicates the rhs should be evaluated too (ie not short-circuited).
12741274
val keepGoing = new asm.Label
12751275

@@ -1310,7 +1310,7 @@ trait BCodeBodyBuilder extends BCodeSkelBuilder {
13101310
* @param l left-hand-side of the '=='
13111311
* @param r right-hand-side of the '=='
13121312
*/
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 = {
13141314

13151315
/* True if the equality comparison is between values that require the use of the rich equality
13161316
* comparator (scala.runtime.Comparator.equals). This is the case when either side of the

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
120120
*
121121
* can-multi-thread
122122
*/
123-
final def addInnerClassesASM(jclass: asm.ClassVisitor, refedInnerClasses: List[ClassBType]) {
123+
final def addInnerClassesASM(jclass: asm.ClassVisitor, refedInnerClasses: List[ClassBType]): Unit = {
124124
val allNestedClasses = refedInnerClasses.flatMap(_.enclosingNestedClassesChain).distinct
125125

126126
// sorting ensures nested classes are listed after their enclosing class thus satisfying the Eclipse Java compiler
@@ -323,7 +323,7 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
323323
*
324324
* must-single-thread
325325
*/
326-
def addRemoteExceptionAnnot(isRemoteClass: Boolean, isJMethodPublic: Boolean, meth: Symbol) {
326+
def addRemoteExceptionAnnot(isRemoteClass: Boolean, isJMethodPublic: Boolean, meth: Symbol): Unit = {
327327
val needsAnnotation = (
328328
( isRemoteClass ||
329329
isRemote(meth) && isJMethodPublic
@@ -338,7 +338,7 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
338338
*
339339
* must-single-thread
340340
*/
341-
private def addForwarder(isRemoteClass: Boolean, jclass: asm.ClassVisitor, module: Symbol, m: Symbol) {
341+
private def addForwarder(isRemoteClass: Boolean, jclass: asm.ClassVisitor, module: Symbol, m: Symbol): Unit = {
342342
val moduleName = internalName(module)
343343
val methodInfo = module.thisType.memberInfo(m)
344344
val paramJavaTypes: List[BType] = methodInfo.paramTypes map toTypeKind
@@ -400,7 +400,7 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
400400
*
401401
* must-single-thread
402402
*/
403-
def addForwarders(isRemoteClass: Boolean, jclass: asm.ClassVisitor, jclassName: String, moduleClass: Symbol) {
403+
def addForwarders(isRemoteClass: Boolean, jclass: asm.ClassVisitor, jclassName: String, moduleClass: Symbol): Unit = {
404404
assert(moduleClass.isModuleClass, moduleClass)
405405
debuglog(s"Dumping mirror class for object: $moduleClass")
406406

@@ -454,7 +454,7 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
454454
*
455455
* can-multi-thread
456456
*/
457-
def addSerialVUID(id: Long, jclass: asm.ClassVisitor) {
457+
def addSerialVUID(id: Long, jclass: asm.ClassVisitor): Unit = {
458458
// add static serialVersionUID field if `clasz` annotated with `@SerialVersionUID(uid: Long)`
459459
jclass.visitField(
460460
GenBCodeOps.PublicStaticFinal,
@@ -597,7 +597,7 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
597597
UNIT
598598
)
599599

600-
def push(lst: List[String]) {
600+
def push(lst: List[String]): Unit = {
601601
var fi = 0
602602
for (f <- lst) {
603603
constructor.visitInsn(asm.Opcodes.DUP)
@@ -666,7 +666,7 @@ trait BCodeHelpers extends BCodeIdiomatic with BytecodeWriters {
666666
/*
667667
* must-single-thread
668668
*/
669-
def legacyAddCreatorCode(clinit: asm.MethodVisitor, cnode: asm.tree.ClassNode, thisName: String) {
669+
def legacyAddCreatorCode(clinit: asm.MethodVisitor, cnode: asm.tree.ClassNode, thisName: String): Unit = {
670670
// this tracks the inner class in innerClassBufferASM, if needed.
671671
val androidCreatorType = getClassBTypeAndRegisterInnerClass(AndroidCreatorClass)
672672
val tdesc_creator = androidCreatorType.descriptor

0 commit comments

Comments
 (0)