summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2007-06-06 09:15:36 +0000
committerIulian Dragos <jaguarul@gmail.com>2007-06-06 09:15:36 +0000
commitf324c3aa0729eae530092a9953c7a2ac69b5f6f8 (patch)
tree7f65b9d55639d6d6d3f8961cd721c17717bc95c7 /src
parentee41bd58d4e28008070b4d705511beab36f645e1 (diff)
downloadscala-f324c3aa0729eae530092a9953c7a2ac69b5f6f8.tar.gz
scala-f324c3aa0729eae530092a9953c7a2ac69b5f6f8.tar.bz2
scala-f324c3aa0729eae530092a9953c7a2ac69b5f6f8.zip
Fixed wrong line numbers in ifs.
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/GenICode.scala12
-rw-r--r--src/compiler/scala/tools/nsc/backend/icode/Printers.scala2
2 files changed, 10 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
index 408d49b940..fd396acd37 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
@@ -121,9 +121,9 @@ abstract class GenICode extends SubComponent {
case Return(_) => ()
case EmptyTree =>
error("Concrete method has no definition: " + tree)
- case _ => if (ctx1.bb.isEmpty)
+ case _ => /*if (ctx1.bb.isEmpty)
ctx1.bb.emit(RETURN(m.returnType), rhs.pos)
- else
+ else*/
ctx1.bb.emit(RETURN(m.returnType))
}
ctx1.bb.close
@@ -449,7 +449,10 @@ abstract class GenICode extends SubComponent {
thenCtx.bb.emit(JUMP(contCtx.bb))
thenCtx.bb.close
- elseCtx.bb.emit(JUMP(contCtx.bb))
+ if (elsep == EmptyTree)
+ elseCtx.bb.emit(JUMP(contCtx.bb), tree.pos)
+ else
+ elseCtx.bb.emit(JUMP(contCtx.bb))
elseCtx.bb.close
contCtx
@@ -958,7 +961,8 @@ abstract class GenICode extends SubComponent {
afterCtx
case EmptyTree =>
- ctx.bb.emit(getZeroOf(expectedType))
+ if (expectedType != UNIT)
+ ctx.bb.emit(getZeroOf(expectedType))
ctx
case _ =>
diff --git a/src/compiler/scala/tools/nsc/backend/icode/Printers.scala b/src/compiler/scala/tools/nsc/backend/icode/Printers.scala
index 37139e0ed4..d5c158f3a6 100644
--- a/src/compiler/scala/tools/nsc/backend/icode/Printers.scala
+++ b/src/compiler/scala/tools/nsc/backend/icode/Printers.scala
@@ -126,6 +126,8 @@ trait Printers { self: ICodes =>
def printInstruction(i: Instruction): Unit = {
if (settings.Xdce.value)
print(if (i.useful) " " else " * ");
+ if (settings.debug.value)
+ print(i.pos.line)
println(i.toString());
}
}