summaryrefslogtreecommitdiff
path: root/sources/scalac/transformer/AddInterfaces.java
diff options
context:
space:
mode:
authorschinz <schinz@epfl.ch>2003-05-19 08:37:58 +0000
committerschinz <schinz@epfl.ch>2003-05-19 08:37:58 +0000
commit9c66a1e5b6045efaf925dbd0954a2e55a21c3df3 (patch)
treeaf1fac39c5b3a9803fe686b67872ee938d4f147f /sources/scalac/transformer/AddInterfaces.java
parentb4cfef25570aa814f48c3513ed2cadfcc6059afe (diff)
downloadscala-9c66a1e5b6045efaf925dbd0954a2e55a21c3df3.tar.gz
scala-9c66a1e5b6045efaf925dbd0954a2e55a21c3df3.tar.bz2
scala-9c66a1e5b6045efaf925dbd0954a2e55a21c3df3.zip
- (partial) bug fix: modify ThisTypes appearing...
- (partial) bug fix: modify ThisTypes appearing in classes which have an interface so that they use the class symbol
Diffstat (limited to 'sources/scalac/transformer/AddInterfaces.java')
-rw-r--r--sources/scalac/transformer/AddInterfaces.java14
1 files changed, 13 insertions, 1 deletions
diff --git a/sources/scalac/transformer/AddInterfaces.java b/sources/scalac/transformer/AddInterfaces.java
index 20479eeea4..6e16eeb351 100644
--- a/sources/scalac/transformer/AddInterfaces.java
+++ b/sources/scalac/transformer/AddInterfaces.java
@@ -54,6 +54,7 @@ class AddInterfaces extends Transformer {
protected Pair/*<Symbol,Symbol>*/ ownerSubst = null;
protected StackedHashMap identSubst = new StackedHashMap();
protected SymbolSubstTypeMap typeSubst = new SymbolSubstTypeMap();
+ protected ThisTypeMap thisTypeSubst = null;
protected LinkedList/*<List<Tree>>*/ bodyStack = new LinkedList();
@@ -73,7 +74,11 @@ class AddInterfaces extends Transformer {
public Tree transform(Tree tree) {
// Update tree type, to take into account the new (type)
// symbols of enclosing classes / methods.
- tree.setType(typeSubst.apply(tree.type()));
+ Type newTp = typeSubst.apply(tree.type());
+ if (thisTypeSubst != null)
+ tree.setType(thisTypeSubst.apply(newTp));
+ else
+ tree.setType(newTp);
if (tree.definesSymbol() && !(tree instanceof ClassDef)) {
// Update symbol's owner, if needed.
@@ -271,6 +276,10 @@ class AddInterfaces extends Transformer {
Tree[] classBody = classImpl.body;
Map classMemberMap = phase.getClassMemberMap(classSym);
+
+ assert thisTypeSubst == null;
+ thisTypeSubst = new ThisTypeMap(ifaceSym, new Type.ThisType(classSym));
+
for (int i = 0; i < classBody.length; ++i) {
Tree t = classBody[i];
Symbol tSym = t.symbol();
@@ -286,6 +295,8 @@ class AddInterfaces extends Transformer {
newClassBody.append(newT);
}
+ thisTypeSubst = null;
+
Tree[][] oldParentArgs = extractParentArgs(classImpl.parents);
Tree[][] parentArgs = new Tree[oldParentArgs.length + 1][];
System.arraycopy(oldParentArgs, 0, parentArgs, 0, oldParentArgs.length);
@@ -318,4 +329,5 @@ class AddInterfaces extends Transformer {
protected void popOwnerSubst() {
ownerSubst = (Pair)ownerSubstStack.removeFirst();
}
+
}