summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2007-08-23 10:39:29 +0000
committerBurak Emir <emir@epfl.ch>2007-08-23 10:39:29 +0000
commit466df8f4b7cd55908db561bd32eb1912acaf691b (patch)
tree67c9db1073a1db2031263fc68579861ffabebe28
parent8d96aea0a2d626e78a2f6477cb739447a17be153 (diff)
downloadscala-466df8f4b7cd55908db561bd32eb1912acaf691b.tar.gz
scala-466df8f4b7cd55908db561bd32eb1912acaf691b.tar.bz2
scala-466df8f4b7cd55908db561bd32eb1912acaf691b.zip
in pm, result temp variable owned by current ow...
in pm, result temp variable owned by current owner, not LabelDef (saves an "if" in LambdaLift, but requires one uninitialized ValDef more)
-rw-r--r--src/compiler/scala/tools/nsc/matching/PatternMatchers.scala6
-rw-r--r--src/compiler/scala/tools/nsc/transform/LambdaLift.scala8
2 files changed, 6 insertions, 8 deletions
diff --git a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
index 74d654a267..9e1e14cf89 100644
--- a/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
+++ b/src/compiler/scala/tools/nsc/matching/PatternMatchers.scala
@@ -947,11 +947,13 @@ print()
*/
private def generalSwitchToTree(): Tree = {
this.exit = owner.newLabel(root.pos, "exit").setInfo(new MethodType(List(resultType), resultType));
- val result = exit.newValueParameter(root.pos, "result").setInfo( resultType );
+ //val result = exit.newValueParameter(root.pos, "result").setInfo( resultType );
+ val result = owner.newVariable(root.pos, "result").setInfo( resultType );
squeezedBlock(
List(
typedValDef(root.casted, selector),
- typed { toTree(root.and) },
+ typedValDef(result, EmptyTree /* defaultValue(result.tpe) */),
+ typed { toTree(root.and) },
ThrowMatchError(selector.pos, mkIdent(root.casted))) ,
LabelDef(exit, List(result), mkIdent(result)))
}
diff --git a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
index 925f1e8e61..da5d83989c 100644
--- a/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
+++ b/src/compiler/scala/tools/nsc/transform/LambdaLift.scala
@@ -299,12 +299,8 @@ abstract class LambdaLift extends InfoTransform {
}
private def proxyRef(sym: Symbol) = {
- if (sym.owner.isLabel) //
- gen.mkAttributedIdent(sym) // bq: account for the fact that LambdaLift does not know how to handle references to LabelDef parameters.
- else { //
- val psym = proxy(sym)
- if (psym.isLocal) gen.mkAttributedIdent(psym) else memberRef(psym)
- }
+ val psym = proxy(sym)
+ if (psym.isLocal) gen.mkAttributedIdent(psym) else memberRef(psym)
}
private def addFreeArgs(pos: Position, sym: Symbol, args: List[Tree]) = {