@@ -246,22 +246,21 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
246
246
247
247
/** An anonymous class
248
248
*
249
- * new parent { forwarders }
249
+ * new parents { forwarders }
250
250
*
251
251
* where `forwarders` contains forwarders for all functions in `fns`.
252
- * `fns` must be non-empty. The class has the same owner as the first function in `fns`.
252
+ * @param parents a non-empty list of class types
253
+ * @param fns a non-empty of functions for which forwarders should be defined in the class.
254
+ * The class has the same owner as the first function in `fns`.
253
255
* Its position is the union of all functions in `fns`.
254
256
*/
255
- def AnonClass (parent : Type , fns : List [TermSymbol ], methNames : List [TermName ])(implicit ctx : Context ): Block = {
256
- def methName (fnName : TermName ): TermName = if (fnName == nme.ANON_FUN ) nme.apply else fnName
257
+ def AnonClass (parents : List [Type ], fns : List [TermSymbol ], methNames : List [TermName ])(implicit ctx : Context ): Block = {
257
258
val owner = fns.head.owner
258
- val parents =
259
- if (parent. classSymbol.is(Trait )) defn.ObjectClass .typeRef :: parent :: Nil
260
- else parent :: Nil
261
- val cls = ctx.newNormalizedClassSymbol(owner, tpnme.ANON_FUN , Synthetic , parents ,
259
+ val parents1 =
260
+ if (parents.head. classSymbol.is(Trait )) defn.ObjectClass .typeRef :: parents
261
+ else parents
262
+ val cls = ctx.newNormalizedClassSymbol(owner, tpnme.ANON_FUN , Synthetic , parents1 ,
262
263
coord = fns.map(_.pos).reduceLeft(_ union _))
263
- println(i " creating anon class with parent $parent -> ${cls.info.parents}%, % " )
264
- println(cls.classInfo.classParents)
265
264
val constr = ctx.newConstructor(cls, Synthetic , Nil , Nil ).entered
266
265
def forwarder (fn : TermSymbol , name : TermName ) = {
267
266
val fwdMeth = fn.copy(cls, name, Synthetic | Method ).entered.asTerm
0 commit comments