summaryrefslogtreecommitdiff
path: root/sources/scala/tools/nsc/transform/AddInterfaces.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2005-09-23 12:28:07 +0000
committerMartin Odersky <odersky@gmail.com>2005-09-23 12:28:07 +0000
commitfcc3a4867d2df32377b56c908c46617a92745ce8 (patch)
tree534c4deb305f19ca3c3a76b3472b87c7dadb868d /sources/scala/tools/nsc/transform/AddInterfaces.scala
parent14c330159a76b428b4ca5aa25c112d61836bd79a (diff)
downloadscala-fcc3a4867d2df32377b56c908c46617a92745ce8.tar.gz
scala-fcc3a4867d2df32377b56c908c46617a92745ce8.tar.bz2
scala-fcc3a4867d2df32377b56c908c46617a92745ce8.zip
*** empty log message ***
Diffstat (limited to 'sources/scala/tools/nsc/transform/AddInterfaces.scala')
-rwxr-xr-xsources/scala/tools/nsc/transform/AddInterfaces.scala25
1 files changed, 16 insertions, 9 deletions
diff --git a/sources/scala/tools/nsc/transform/AddInterfaces.scala b/sources/scala/tools/nsc/transform/AddInterfaces.scala
index bb6c6721ff..a266590f51 100755
--- a/sources/scala/tools/nsc/transform/AddInterfaces.scala
+++ b/sources/scala/tools/nsc/transform/AddInterfaces.scala
@@ -24,6 +24,11 @@ abstract class AddInterfaces extends InfoTransform {
private val implClassMap = new HashMap[Symbol, Symbol];
private val implMethodMap = new HashMap[Symbol, Symbol];
+ override def resetTransform: unit = {
+ implClassMap.clear;
+ implMethodMap.clear
+ }
+
private def needsImplMethod(sym: Symbol): boolean =
sym.isMethod && isInterfaceMember(sym) &&
(!(sym hasFlag (DEFERRED | SUPERACCESSOR)) || (sym hasFlag lateDEFERRED));
@@ -36,15 +41,17 @@ abstract class AddInterfaces extends InfoTransform {
case Some(c) => c
case None =>
atPhase(erasurePhase) {
- val impl = iface.cloneSymbolImpl(iface.owner)
- setFlag (iface.flags & ~(INTERFACE | lateINTERFACE))
- setInfo new LazyImplClassType(iface);
- impl.name = nme.implClassName(iface.name);
- //includeInTypeOfThis(iface, impl);
- //includeInTypeOfThis(impl, impl);
- //todo: use implClassMap only for local impl classes
+ val implName = nme.implClassName(iface.name);
+ var impl = if (iface.owner.isClass) iface.owner.info.decls.lookup(implName) else NoSymbol;
+ if (impl == NoSymbol) {
+ impl = iface.cloneSymbolImpl(iface.owner);
+ impl.name = implName;
+ if (iface.owner.isClass) iface.owner.info.decls enter impl
+ }
+ impl.pos = iface.pos;
+ impl.flags = iface.flags & ~(INTERFACE | lateINTERFACE);
+ impl setInfo new LazyImplClassType(iface);
implClassMap(iface) = impl;
- if (iface.owner.isClass) iface.owner.info.decls enter impl;
if (settings.debug.value) log("generating impl class " + impl);
impl
}
@@ -145,7 +152,7 @@ abstract class AddInterfaces extends InfoTransform {
new ChangeOwnerAndReturnTraverser(ifaceMethod, implMethod).traverse(tree);
tree
case None =>
- throw new Error("implMethod missing for " + ifaceMethod + " " + ifaceMethod.isExternal)
+ throw new Error("implMethod missing for " + ifaceMethod)
}
private def implMemberDef(tree: Tree): Tree =