@@ -129,7 +129,6 @@ trait BCodeSkelBuilder extends BCodeHelpers {
129129
130130 val (clinits, body) = impl.body.partition(stat => stat.isInstanceOf [DefDef ] && stat.symbol.isStaticConstructor)
131131
132- val (uptoSuperStats, remainingConstrStats) = splitAtSuper(impl.constr.rhs.asInstanceOf [Block ].stats)
133132 val clInitSymbol : TermSymbol =
134133 if (clinits.nonEmpty) clinits.head.symbol.asTerm
135134 else ctx.newSymbol(
@@ -150,40 +149,42 @@ trait BCodeSkelBuilder extends BCodeHelpers {
150149 coord = claszSymbol.coord
151150 ).entered
152151
153- val thisMap = new TreeMap {
154- override def transform (tree : Tree )(using Context ) = {
155- val tp = tree.tpe.substThis(claszSymbol.asClass, claszSymbol.sourceModule.termRef)
156- tree.withType(tp) match {
157- case tree : This if tree.symbol == claszSymbol =>
158- ref(claszSymbol.sourceModule)
159- case Apply (fun @ Select (Super (qual, _), _), args) if qual.symbol == claszSymbol =>
160- ref(claszSymbol.sourceModule).select(fun.symbol).appliedToArgs(args)
161- // case ident: Ident =>
162- // super.transform(desugarIdent(ident))
163- case tree =>
164- super .transform(tree)
165- }
166- }
167- }
168-
169- def rewire (stat : Tree ) = thisMap.transform(stat).changeOwner(claszSymbol.primaryConstructor, clInitSymbol)
152+ // val thisMap = new TreeMap {
153+ // override def transform(tree: Tree)(using Context) = {
154+ // val tp = tree.tpe.substThis(claszSymbol.asClass, claszSymbol.sourceModule.termRef)
155+ // tree.withType(tp) match {
156+ // case tree: This if tree.symbol == claszSymbol =>
157+ // ref(claszSymbol.sourceModule)
158+ // case Apply(fun @ Select(Super(qual, mix), _), args) if qual.symbol == claszSymbol =>
159+ // ref(claszSymbol.sourceModule).select(fun.symbol).appliedToArgs(args)
160+ // case ident: Ident =>
161+ // super.transform(desugarIdent(ident))
162+ // case tree =>
163+ // super.transform(tree)
164+ // }
165+ // }
166+ // }
167+
168+ // def rewire(stat: Tree) = thisMap.transform(stat).changeOwner(claszSymbol.primaryConstructor, clInitSymbol)
169+
170+ // val (uptoSuperStats, remainingConstrStats) = splitAtSuper(impl.constr.rhs.asInstanceOf[Block].stats)
171+ // val remainingConstrStatsSubst = remainingConstrStats.map(rewire)
170172
171173 val callConstructor = New (claszSymbol.typeRef).select(claszSymbol.primaryConstructor).appliedToArgs(Nil )
172174 val assignModuleField = Assign (ref(moduleField), callConstructor)
173- val remainingConstrStatsSubst = remainingConstrStats.map(rewire)
174175 val clinit = clinits match {
175176 case (ddef : DefDef ) :: _ =>
176- cpy.DefDef (ddef)(rhs = Block (ddef.rhs :: assignModuleField :: remainingConstrStatsSubst , unitLiteral))
177+ cpy.DefDef (ddef)(rhs = Block (ddef.rhs :: assignModuleField :: Nil , unitLiteral))
177178 case _ =>
178- DefDef (clInitSymbol, Block (assignModuleField :: remainingConstrStatsSubst , unitLiteral))
179+ DefDef (clInitSymbol, Block (assignModuleField :: Nil , unitLiteral))
179180 }
180181
181- val constr2 = {
182- val rhs = Block (uptoSuperStats, impl.constr.rhs.asInstanceOf [Block ].expr)
183- cpy.DefDef (impl.constr)(rhs = rhs)
184- }
182+ // val constr2 = {
183+ // val rhs = Block(uptoSuperStats, impl.constr.rhs.asInstanceOf[Block].expr)
184+ // cpy.DefDef(impl.constr)(rhs = rhs)
185+ // }
185186
186- val impl2 = cpy.Template (impl)(constr = constr2, body = clinit :: body)
187+ val impl2 = cpy.Template (impl)(body = clinit :: body)
187188 cpy.TypeDef (cd0)(rhs = impl2)
188189 } else cd0
189190
0 commit comments