diff options
-rw-r--r-- | sources/scalac/transformer/matching/RightTracerInScala.java | 17 | ||||
-rw-r--r-- | sources/scalac/transformer/matching/SequenceMatcher.java | 20 |
2 files changed, 18 insertions, 19 deletions
diff --git a/sources/scalac/transformer/matching/RightTracerInScala.java b/sources/scalac/transformer/matching/RightTracerInScala.java index dc2249e58f..886dd17f7c 100644 --- a/sources/scalac/transformer/matching/RightTracerInScala.java +++ b/sources/scalac/transformer/matching/RightTracerInScala.java @@ -436,7 +436,7 @@ System.out.println("RightTracerInScala - the seqVars"+seqVars); /* returns statements that do the work of the right-transducer */ - Tree[] getStms( Tree trace ) { + Tree[] getStms( Tree trace, Unit unit, Tree body ) { Vector v = new Vector(); @@ -465,6 +465,21 @@ System.out.println("RightTracerInScala - the seqVars"+seqVars); } */ + Transformer treeCloner = new Transformer(unit.global) { + public Tree transform(Tree tree) { + tree = super.transform(tree); + if (tree.hasSymbol()) { + Object symbol = helpMap2.get(tree.symbol()); + if (symbol != null) tree.setSymbol((Symbol)symbol); + } + return tree; + } + }; + //System.out.println("helpmap"); + //System.out.println( rtis.helpMap2 ); + + v.add( treeCloner.transform( body ) ); + Tree result[] = new Tree[ v.size() ]; int j = 0; diff --git a/sources/scalac/transformer/matching/SequenceMatcher.java b/sources/scalac/transformer/matching/SequenceMatcher.java index 0fae04cf51..97b23c9646 100644 --- a/sources/scalac/transformer/matching/SequenceMatcher.java +++ b/sources/scalac/transformer/matching/SequenceMatcher.java @@ -66,31 +66,15 @@ public class SequenceMatcher extends PatternTool { new RightTracerInScala( dRight, seqVars, _m.owner, cf, pat, elementType ); - Tree stms2[] = rtis.getStms( theTrace ); + Tree stms2[] = rtis.getStms( theTrace, unit, body ); // paste statements together - Tree items[] = new Tree[ stms.length + stms2.length + 1 ]; + Tree items[] = new Tree[ stms.length + stms2.length ]; System.arraycopy( stms, 0, items, 0, stms.length ); System.arraycopy( stms2, 0, items, stms.length, stms2.length ); - items[ stms.length + stms2.length ] = body; - - Transformer treeCloner = new Transformer(unit.global) { - public Tree transform(Tree tree) { - tree = super.transform(tree); - if (tree.hasSymbol()) { - Object symbol = rtis.helpMap2.get(tree.symbol()); - if (symbol != null) tree.setSymbol((Symbol)symbol); - } - return tree; - } - }; - //System.out.println("helpmap"); - //System.out.println( rtis.helpMap2 ); - - items[ stms.length + stms2.length ] = treeCloner.transform( body ); return gen.mkBlock( body.pos, items ); } |