summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLukas Rytz <lukas.rytz@gmail.com>2014-09-11 10:22:37 +0200
committerLukas Rytz <lukas.rytz@gmail.com>2014-09-11 10:24:14 +0200
commit9132efa4a8511e267c808c95df4d2e3de68277e6 (patch)
tree1b3bd243bcb19ed41609e67ce0f6d94ee2704a78 /src
parent59070cc385560b48267cbc77e872027dd8304c05 (diff)
downloadscala-9132efa4a8511e267c808c95df4d2e3de68277e6.tar.gz
scala-9132efa4a8511e267c808c95df4d2e3de68277e6.tar.bz2
scala-9132efa4a8511e267c808c95df4d2e3de68277e6.zip
Address review feedback.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala4
-rw-r--r--src/compiler/scala/tools/nsc/backend/jvm/BackendStats.scala6
-rw-r--r--src/partest-extras/scala/tools/partest/ASMConverters.scala4
-rw-r--r--src/partest-extras/scala/tools/partest/BytecodeTest.scala2
4 files changed, 7 insertions, 9 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
index ba97cf3748..daf36ce374 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala
@@ -824,7 +824,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
* the stack. "Phantom" because it never exists: such methods always throw, but the JVM does
* not know that.
*
- * Note: The two verifiers (old: type inference, new: type checking) have differnet
+ * Note: The two verifiers (old: type inference, new: type checking) have different
* requirements. Very briefly:
*
* Old (http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.10.2.1): at
@@ -832,7 +832,7 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder {
* - Stack is same size and has same typed values
* - Local and stack values need to have consistent types
* - In practice, the old verifier seems to ignore unreachable code and accept any
- * instrucitons after an ATHROW. For example, there can be another ATHROW (without
+ * instructions after an ATHROW. For example, there can be another ATHROW (without
* loading another throwable first).
*
* New (http://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.10.1)
diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BackendStats.scala b/src/compiler/scala/tools/nsc/backend/jvm/BackendStats.scala
index d96ee933b7..4b9383c67c 100644
--- a/src/compiler/scala/tools/nsc/backend/jvm/BackendStats.scala
+++ b/src/compiler/scala/tools/nsc/backend/jvm/BackendStats.scala
@@ -17,10 +17,8 @@ object BackendStats {
val bcodeDceTimer = newSubTimer("dead code elimination", bcodeTimer)
val bcodeWriteTimer = newSubTimer("classfile writing", bcodeTimer)
- def timed[T](timer: Statistics.Timer)(body: => T) = {
+ def timed[T](timer: Statistics.Timer)(body: => T): T = {
val start = Statistics.startTimer(timer)
- val res = body
- Statistics.stopTimer(timer, start)
- res
+ try body finally Statistics.stopTimer(timer, start)
}
}
diff --git a/src/partest-extras/scala/tools/partest/ASMConverters.scala b/src/partest-extras/scala/tools/partest/ASMConverters.scala
index d443a31112..67a4e8ae01 100644
--- a/src/partest-extras/scala/tools/partest/ASMConverters.scala
+++ b/src/partest-extras/scala/tools/partest/ASMConverters.scala
@@ -141,9 +141,9 @@ object ASMConverters {
}
def sameVar(v1: Int, v2: Int) = same(v1, v2, varMap)
def sameLabel(l1: Label, l2: Label) = same(l1.offset, l2.offset, labelMap)
- def sameLabels(ls1: List[Label], ls2: List[Label]) = ls1.length == ls2.length && (ls1, ls2).zipped.forall(sameLabel)
+ def sameLabels(ls1: List[Label], ls2: List[Label]) = (ls1 corresponds ls2)(sameLabel)
- def sameFrameTypes(ts1: List[Any], ts2: List[Any]) = ts1.length == ts2.length && (ts1, ts2).zipped.forall {
+ def sameFrameTypes(ts1: List[Any], ts2: List[Any]) = (ts1 corresponds ts2) {
case (t1: Label, t2: Label) => sameLabel(t1, t2)
case (x, y) => x == y
}
diff --git a/src/partest-extras/scala/tools/partest/BytecodeTest.scala b/src/partest-extras/scala/tools/partest/BytecodeTest.scala
index c6fa279c50..3261cada37 100644
--- a/src/partest-extras/scala/tools/partest/BytecodeTest.scala
+++ b/src/partest-extras/scala/tools/partest/BytecodeTest.scala
@@ -84,7 +84,7 @@ abstract class BytecodeTest {
/**
* Compare the bytecodes of two methods.
*
- * The for the `similar` function, you probably want to pass [[ASMConverters.equivalentBytecode]].
+ * For the `similar` function, you probably want to pass [[ASMConverters.equivalentBytecode]].
*/
def similarBytecode(methA: MethodNode, methB: MethodNode, similar: (List[Instruction], List[Instruction]) => Boolean) = {
val isa = instructionsFromMethod(methA)