diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/ast/TreeInfo.scala | 11 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/transform/AddInterfaces.scala | 11 |
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)) |