summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2007-04-05 15:01:04 +0000
committerMartin Odersky <odersky@gmail.com>2007-04-05 15:01:04 +0000
commit289fd3d7307ca117a419e71e3a20b0b811a0d33f (patch)
tree4c913bba902e2a38df55b734ea118c088b9aa72f /src
parentb5b3ce4df69c6dd19506cd332a97c1ad6660e4a5 (diff)
downloadscala-289fd3d7307ca117a419e71e3a20b0b811a0d33f.tar.gz
scala-289fd3d7307ca117a419e71e3a20b0b811a0d33f.tar.bz2
scala-289fd3d7307ca117a419e71e3a20b0b811a0d33f.zip
small changes to supercalls
Diffstat (limited to 'src')
-rw-r--r--src/compiler/scala/tools/nsc/ast/TreeInfo.scala11
-rw-r--r--src/compiler/scala/tools/nsc/transform/AddInterfaces.scala11
2 files changed, 15 insertions, 7 deletions
diff --git a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
index aba34b0d51..0ce35746ab 100644
--- a/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
+++ b/src/compiler/scala/tools/nsc/ast/TreeInfo.scala
@@ -128,6 +128,17 @@ abstract class TreeInfo {
false
}
+ def isSuperConstrCall(tree: Tree): boolean = tree match {
+ case Select(Super(_, _), nme.CONSTRUCTOR) =>
+ true
+ case TypeApply(constr, _) =>
+ isSuperConstrCall(constr)
+ case Apply(constr, _) =>
+ isSuperConstrCall(constr)
+ case _ =>
+ false
+ }
+
/** Is tree a variable pattern */
def isVarPattern(pat: Tree): boolean = pat match {
case Ident(name) => isVariableName(name) && !pat.isInstanceOf[BackQuotedIdent]
diff --git a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
index 3de9399779..b1235c9c94 100644
--- a/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
+++ b/src/compiler/scala/tools/nsc/transform/AddInterfaces.scala
@@ -129,9 +129,8 @@ abstract class AddInterfaces extends InfoTransform {
*/
private def implDecls(implClass: Symbol, ifaceDecls: Scope): Scope = {
val decls = newScope
- if ((ifaceDecls lookup nme.MIXIN_CONSTRUCTOR) == NoSymbol)
- decls enter (implClass.newMethod(implClass.pos, nme.MIXIN_CONSTRUCTOR)
- setInfo MethodType(List(), UnitClass.tpe))
+ decls enter (implClass.newMethod(implClass.pos, nme.MIXIN_CONSTRUCTOR)
+ setInfo MethodType(List(), UnitClass.tpe))
for (val sym <- ifaceDecls.elements) {
if (isInterfaceMember(sym)) {
if (needsImplMethod(sym)) {
@@ -253,10 +252,8 @@ abstract class AddInterfaces extends InfoTransform {
private def implTemplate(clazz: Symbol, templ: Template): Template = atPos(templ.pos) {
val templ1 = atPos(templ.pos) {
- var ibody = templ.body map implMemberDef
- if (!(ibody exists (stat => stat.isDef && stat.symbol.isMixinConstructor)))
- ibody = mixinConstructorDef(clazz) :: ibody
- Template(templ.parents, ibody) setSymbol clazz.newLocalDummy(templ.pos)
+ Template(templ.parents, mixinConstructorDef(clazz) :: (templ.body map implMemberDef))
+ .setSymbol(clazz.newLocalDummy(templ.pos))
}
new ChangeOwnerTraverser(templ.symbol.owner, clazz)(
new ChangeOwnerTraverser(templ.symbol, templ1.symbol)(templ1))