diff options
author | paltherr <paltherr@epfl.ch> | 2003-07-11 18:30:27 +0000 |
---|---|---|
committer | paltherr <paltherr@epfl.ch> | 2003-07-11 18:30:27 +0000 |
commit | 195efaee57bfd9ebb67b02a6512e87e7026202a2 (patch) | |
tree | 0337d81fa12af12683ca3fad4a7658a635bbaae7 /sources/scalac/transformer/AddInterfaces.java | |
parent | 8e54f08fa4e78a464e2601c7da79001046b2bcc5 (diff) | |
download | scala-195efaee57bfd9ebb67b02a6512e87e7026202a2.tar.gz scala-195efaee57bfd9ebb67b02a6512e87e7026202a2.tar.bz2 scala-195efaee57bfd9ebb67b02a6512e87e7026202a2.zip |
- Changed getClassSubst to return SymbolSubstTy...
- Changed getClassSubst to return SymbolSubstTypeMap Removed identSubst
- (using typeSubst instead)
Diffstat (limited to 'sources/scalac/transformer/AddInterfaces.java')
-rw-r--r-- | sources/scalac/transformer/AddInterfaces.java | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/sources/scalac/transformer/AddInterfaces.java b/sources/scalac/transformer/AddInterfaces.java index aea4c37b69..71b159faf7 100644 --- a/sources/scalac/transformer/AddInterfaces.java +++ b/sources/scalac/transformer/AddInterfaces.java @@ -52,8 +52,7 @@ class AddInterfaces extends Transformer { protected LinkedList/*<Pair<Symbol,Symbol>>*/ ownerSubstStack = new LinkedList(); protected Pair/*<Symbol,Symbol>*/ ownerSubst = null; - protected StackedHashMap identSubst = new StackedHashMap(); - protected SymbolSubstTypeMap typeSubst = new SymbolSubstTypeMap(); + protected SymbolSubstTypeMap typeSubst = null; protected Type.SubstThisMap thisTypeSubst = null; protected LinkedList/*<List<Tree>>*/ bodyStack = new LinkedList(); @@ -74,11 +73,10 @@ class AddInterfaces extends Transformer { public Tree transform(Tree tree) { // Update tree type, to take into account the new (type) // symbols of enclosing classes / methods. - Type newTp = typeSubst.apply(tree.type()); - if (thisTypeSubst != null) - tree.setType(thisTypeSubst.apply(newTp)); - else - tree.setType(newTp); + Type newTp = tree.type(); + if (typeSubst != null) newTp = typeSubst.apply(newTp); + if (thisTypeSubst != null) newTp = thisTypeSubst.apply(newTp); + tree.setType(newTp); if (tree.definesSymbol() && !(tree instanceof ClassDef)) { // Update symbol's owner, if needed. @@ -105,12 +103,9 @@ class AddInterfaces extends Transformer { List/*<Tree>*/ enclosingBody = (List)bodyStack.getFirst(); enclosingBody.add(makeInterface(classDef)); - Map classSubst = phase.getClassSubst(classSym); - identSubst.push(classSubst); - typeSubst.insertSymbol(classSubst); + typeSubst = phase.getClassSubst(classSym); Tree newTree = makeClass(classDef); - typeSubst.removeSymbol(classSubst.keySet()); - identSubst.pop(); + typeSubst = null; return newTree; } else @@ -135,17 +130,16 @@ class AddInterfaces extends Transformer { global.nextPhase(); typeSubst.insertSymbol(sym.typeParams(), newSym.typeParams()); - identSubst.putAll(sym.valueParams(), newSym.valueParams()); + typeSubst.insertSymbol(sym.valueParams(), newSym.valueParams()); global.prevPhase(); - identSubst.push(); pushOwnerSubst(sym, newSym); newTree = gen.DefDef(newSym, transform(rhs)); popOwnerSubst(); - identSubst.pop(); + typeSubst.removeSymbol(sym.valueParams()); typeSubst.removeSymbol(sym.typeParams()); } else newTree = super.transform(tree); @@ -196,12 +190,14 @@ class AddInterfaces extends Transformer { return gen.Ident(phase.getClassSymbol(clsSym).constructor()); else return super.transform(tree); - } else { - Symbol newSym = (Symbol)identSubst.get(tree.symbol()); + } else if (typeSubst != null) { + Symbol newSym = (Symbol)typeSubst.lookupSymbol(tree.symbol()); if (newSym != null) return gen.Ident(newSym); else return super.transform(tree); + } else { + return super.transform(tree); } } |