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