summaryrefslogtreecommitdiff
path: root/sources/scalac/transformer
diff options
context:
space:
mode:
Diffstat (limited to 'sources/scalac/transformer')
-rw-r--r--sources/scalac/transformer/Erasure.java17
-rw-r--r--sources/scalac/transformer/LambdaLift.java8
2 files changed, 19 insertions, 6 deletions
diff --git a/sources/scalac/transformer/Erasure.java b/sources/scalac/transformer/Erasure.java
index e0bd2ac922..4b20d3042c 100644
--- a/sources/scalac/transformer/Erasure.java
+++ b/sources/scalac/transformer/Erasure.java
@@ -376,10 +376,14 @@ public class Erasure extends Transformer implements Modifiers {
return copy.If(tree, cond1, thenp1, elsep1).setType(owntype);
case Switch(Tree test, int[] tags, Tree[] bodies, Tree otherwise):
- test = transform(test, Type.unboxedType(TypeTags.INT));
- bodies = transform(bodies, owntype);
- otherwise = transform(otherwise, owntype);
- return copy.Switch(tree, test, tags, bodies, otherwise).setType(owntype);
+ Tree test1 = transform(test, Type.unboxedType(TypeTags.INT));
+ Tree[] bodies1 = transform(bodies, owntype);
+ Tree otherwise1 = transform(otherwise, owntype);
+ return copy.Switch(tree, test1, tags, bodies1, otherwise1).setType(owntype);
+
+ case Return(Tree expr):
+ Tree expr1 = transform(expr, tree.symbol().type().resultType());
+ return copy.Return(tree, expr1).setType(owntype);
case New(Template templ):
if (tree.type.symbol() == definitions.UNIT_CLASS)
@@ -588,8 +592,9 @@ public class Erasure extends Transformer implements Modifiers {
Tree transformLhs(Tree tree) {
Tree tree1;
switch (tree) {
- case Ident(_):
- tree1 = tree;
+ case Ident(Name name):
+ if (name == Names.ZERO) tree1 = gen.Ident(definitions.NULL);
+ else tree1 = tree;
break;
case Select(Tree qual, _):
Symbol sym = tree.symbol();
diff --git a/sources/scalac/transformer/LambdaLift.java b/sources/scalac/transformer/LambdaLift.java
index 9384055c77..6e14e6ff66 100644
--- a/sources/scalac/transformer/LambdaLift.java
+++ b/sources/scalac/transformer/LambdaLift.java
@@ -38,6 +38,7 @@ public class LambdaLift extends OwnerTransformer
final Definitions definitions;
final FreeVars free;
final LambdaLiftPhase descr;
+ private Unit unit;
public LambdaLift(Global global, LambdaLiftPhase descr) {
super(global);
@@ -48,6 +49,7 @@ public class LambdaLift extends OwnerTransformer
}
public void apply(Unit unit) {
+ this.unit = unit;
global.log(unit.source.toString());
free.initialize(unit);
currentOwner = global.definitions.ROOT_CLASS;
@@ -412,6 +414,12 @@ public class LambdaLift extends OwnerTransformer
//new scalac.ast.printer.TextTreePrinter().print("TUPLE: ").print(tree).print("\n ==> \n").print(tree1).println().end();//DEBUG
return tree1;
+ case Return(Tree expr):
+ if (tree.symbol() != currentOwner.enclMethod()) {
+ unit.error(tree.pos, "non-local return not yet implemented");
+ }
+ return super.transform(tree);
+
case Apply(Tree fn, Tree[] args):
Symbol fsym = TreeInfo.methSymbol(fn);
Tree fn1 = transform(fn);