ClassDef

oxygen.meta.Meta.Tree.Statement.Definition.ClassDef
See theClassDef companion class
object ClassDef

Attributes

Companion
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type
ClassDef.type

Members list

Type members

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def copy(original: Tree)(name: String, constr: DefDef, parents: List[TermOrTypeTree], selfOpt: Option[ValDef], body: List[Statement]): ClassDef

Experimental methods

def apply(cls: Symbol, parents: List[TermOrTypeTree], body: List[Statement]): ClassDef

Create a class definition tree

Create a class definition tree

Value parameters

body

List of members of the class. The members must align with the members of cls.

cls

The class symbol. A new class symbol can be created using Symbol.newClass.

parents

The parents trees class. The trees must align with the parent types of cls. Parents can be TypeTrees if they don't have term parameter, otherwise the can be Term containing the New applied to the parameters of the extended class.

Attributes

Experimental
true
def module(module: Symbol, parents: List[TermOrTypeTree], body: List[Statement]): (ValDef, ClassDef)

Create the ValDef and ClassDef of a module (equivalent to an object declaration in source code).

Create the ValDef and ClassDef of a module (equivalent to an object 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)

Value parameters

body

body of the module class

module

the module symbol (created using Symbol.newModule)

parents

parents of the module class

Attributes

Returns

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.

Experimental
true