diff options
author | Paul Phillips <paulp@improving.org> | 2012-12-06 12:20:31 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-12-06 12:20:31 -0800 |
commit | 6ee2ce50a56237eed07bcc6b6198f97779208a02 (patch) | |
tree | df7a9386e892beafff42bddcc0347f9337cfd3df /src/compiler/scala/tools/nsc/transform/CleanUp.scala | |
parent | 330c77b097782ed389a83175302379ea72d22c41 (diff) | |
parent | 96fa31d0a3cf7ff401f9197cd0e12acd296e55b1 (diff) | |
download | scala-6ee2ce50a56237eed07bcc6b6198f97779208a02.tar.gz scala-6ee2ce50a56237eed07bcc6b6198f97779208a02.tar.bz2 scala-6ee2ce50a56237eed07bcc6b6198f97779208a02.zip |
Merge commit 'refs/pull/1718/head' into merge-msil-genjvm-delete
* commit 'refs/pull/1718/head':
Expunged the .net backend.
Conflicts:
build.detach.xml
build.examples.xml
build.xml
project/Build.scala
src/compiler/scala/tools/ant/Scalac.scala
src/compiler/scala/tools/nsc/Global.scala
src/compiler/scala/tools/nsc/settings/StandardScalaSettings.scala
src/compiler/scala/tools/nsc/symtab/clr/TypeParser.scala
src/compiler/scala/tools/nsc/transform/Mixin.scala
src/intellij/compiler.iml.SAMPLE
tools/buildcp
Diffstat (limited to 'src/compiler/scala/tools/nsc/transform/CleanUp.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/CleanUp.scala | 29 |
1 files changed, 2 insertions, 27 deletions
diff --git a/src/compiler/scala/tools/nsc/transform/CleanUp.scala b/src/compiler/scala/tools/nsc/transform/CleanUp.scala index 3af9c6d74d..765ef39e6b 100644 --- a/src/compiler/scala/tools/nsc/transform/CleanUp.scala +++ b/src/compiler/scala/tools/nsc/transform/CleanUp.scala @@ -69,12 +69,6 @@ abstract class CleanUp extends Transform with ast.TreeDSL { case "mono-cache" => MONO_CACHE case "poly-cache" => POLY_CACHE } - - def shouldRewriteTry(tree: Try) = { - val sym = tree.tpe.typeSymbol - forMSIL && (sym != UnitClass) && (sym != NothingClass) - } - private def typedWithPos(pos: Position)(tree: Tree) = localTyper.typedPos(pos)(tree) @@ -543,10 +537,9 @@ abstract class CleanUp extends Transform with ast.TreeDSL { * constructor. */ case Template(parents, self, body) => localTyper = typer.atOwner(tree, currentClass) - if (forMSIL) savingStatics( transformTemplate(tree) ) - else transformTemplate(tree) + transformTemplate(tree) - case Literal(c) if (c.tag == ClazzTag) && !forMSIL=> + case Literal(c) if c.tag == ClazzTag => val tpe = c.typeValue typedWithPos(tree.pos) { if (isPrimitiveValueClass(tpe.typeSymbol)) { @@ -559,24 +552,6 @@ abstract class CleanUp extends Transform with ast.TreeDSL { else tree } - /* MSIL requires that the stack is empty at the end of a try-block. - * Hence, we here rewrite all try blocks with a result != {Unit, All} such that they - * store their result in a local variable. The catch blocks are adjusted as well. - * The try tree is subsituted by a block whose result expression is read of that variable. */ - case theTry @ Try(block, catches, finalizer) if shouldRewriteTry(theTry) => - def transformTry = { - val tpe = theTry.tpe.widen - val tempVar = currentOwner.newVariable(mkTerm(nme.EXCEPTION_RESULT_PREFIX), theTry.pos).setInfo(tpe) - def assignBlock(rhs: Tree) = super.transform(BLOCK(Ident(tempVar) === transform(rhs))) - - val newBlock = assignBlock(block) - val newCatches = for (CaseDef(pattern, guard, body) <- catches) yield - (CASE(super.transform(pattern)) IF (super.transform(guard))) ==> assignBlock(body) - val newTry = Try(newBlock, newCatches, super.transform(finalizer)) - - typedWithPos(theTry.pos)(BLOCK(VAL(tempVar) === EmptyTree, newTry, Ident(tempVar))) - } - transformTry /* * This transformation should identify Scala symbol invocations in the tree and replace them * with references to a static member. Also, whenever a class has at least a single symbol invocation |