diff options
author | Iulian Dragos <jaguarul@gmail.com> | 2009-03-24 13:17:04 +0000 |
---|---|---|
committer | Iulian Dragos <jaguarul@gmail.com> | 2009-03-24 13:17:04 +0000 |
commit | 89ddf2d6e707ce4f71633b1816b57d3282cfcf76 (patch) | |
tree | 0358de5c044827251b3a437dce6af5c7659eba7f /src/compiler | |
parent | 9257aeb98b5d67645dd67e399023f2ff04d90498 (diff) | |
download | scala-89ddf2d6e707ce4f71633b1816b57d3282cfcf76.tar.gz scala-89ddf2d6e707ce4f71633b1816b57d3282cfcf76.tar.bz2 scala-89ddf2d6e707ce4f71633b1816b57d3282cfcf76.zip |
Fixed #1789
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/icode/GenICode.scala | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index 413d3be7ed..69f0d1f826 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -506,6 +506,8 @@ abstract class GenICode extends SubComponent { if (guardResult) { tmp = ctx.makeLocal(tree.pos, tree.tpe, "tmp") } + def duplicateFinalizer = + (new DuplicateLabels(ctx.labels.keySet))(ctx, finalizer) var handlers = for (CaseDef(pat, _, body) <- catches.reverse) yield pat match { @@ -515,11 +517,11 @@ abstract class GenICode extends SubComponent { val ctx1 = genLoad(body, ctx, kind); if (guardResult) { ctx1.bb.emit(STORE_LOCAL(tmp)) - val ctx2 = genLoad(finalizer, ctx1, UNIT) + val ctx2 = genLoad(duplicateFinalizer, ctx1, UNIT) ctx2.bb.emit(LOAD_LOCAL(tmp)) ctx2 } else - genLoad(finalizer, ctx1, UNIT); + genLoad(duplicateFinalizer, ctx1, UNIT); }) case Ident(nme.WILDCARD) => (definitions.ThrowableClass, kind, { @@ -528,11 +530,11 @@ abstract class GenICode extends SubComponent { val ctx1 = genLoad(body, ctx, kind) if (guardResult) { ctx1.bb.emit(STORE_LOCAL(tmp)) - val ctx2 = genLoad(finalizer, ctx1, UNIT) + val ctx2 = genLoad(duplicateFinalizer, ctx1, UNIT) ctx2.bb.emit(LOAD_LOCAL(tmp)) ctx2 } else - genLoad(finalizer, ctx1, UNIT) + genLoad(duplicateFinalizer, ctx1, UNIT) }) case Bind(name, _) => @@ -544,17 +546,16 @@ abstract class GenICode extends SubComponent { val ctx1 = genLoad(body, ctx, kind); if (guardResult) { ctx1.bb.emit(STORE_LOCAL(tmp)) - val ctx2 = genLoad(finalizer, ctx1, UNIT) + val ctx2 = genLoad(duplicateFinalizer, ctx1, UNIT) ctx2.bb.emit(LOAD_LOCAL(tmp)) ctx2 } else - genLoad(finalizer, ctx1, UNIT); + genLoad(duplicateFinalizer, ctx1, UNIT); }) } - val duppedFinalizer = (new DuplicateLabels(ctx.labels.keySet))(ctx, finalizer) if (settings.debug.value) - log("Duplicated finalizer: " + duppedFinalizer) + log("Duplicated finalizer: " + duplicateFinalizer) ctx.Try( bodyCtx => { generatedType = kind; //toTypeKind(block.tpe); @@ -562,11 +563,11 @@ abstract class GenICode extends SubComponent { if (guardResult) { val tmp = ctx1.makeLocal(tree.pos, tree.tpe, "tmp") ctx1.bb.emit(STORE_LOCAL(tmp)) - val ctx2 = genLoad(duppedFinalizer, ctx1, UNIT) + val ctx2 = genLoad(duplicateFinalizer, ctx1, UNIT) ctx2.bb.emit(LOAD_LOCAL(tmp)) ctx2 } else - genLoad(duppedFinalizer, ctx1, UNIT) + genLoad(duplicateFinalizer, ctx1, UNIT) }, handlers, finalizer) |