Methods of the module objectval ClassDef
Create a class definition tree
Create a class definition tree
List of members of the class. The members must align with the members ofcls.
The class symbol. A new class symbol can be created usingSymbol.newClass.
The parents trees class. The trees must align with the parent types ofcls. Parents can beTypeTrees if they don't have term parameter, otherwise the can beTerm containing theNew applied to the parameters of the extended class.
Create the ValDef and ClassDef of a module (equivalent to anobject declaration in source code).
Create the ValDef and ClassDef of a module (equivalent to anobject declaration in source code).
Equivalent to
def module(module: Symbol, parents: List[Tree], body: List[Statement]): (ValDef, ClassDef) = val modCls = module.moduleClass val modClassDef = ClassDef(modCls, parents, body) val modValDef = ValDef(module, Some(Apply(Select(New(TypeIdent(modCls)), cls.primaryConstructor), Nil))) List(modValDef, modClassDef)body of the module class
the module symbol (created usingSymbol.newModule)
parents of the module class
The module lazy val definition and module class definition. These should be added one after the other (in that order) in the body of a class or statements of a block.