Movatterモバイル変換


[0]ホーム

URL:


Scala 3
3.7.4
LearnInstallPlaygroundFind A LibraryCommunityBlog
Scala 3
LearnInstallPlaygroundFind A LibraryCommunityBlog
DocsAPI
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL
Scala 3/scala/scala.quoted/Quotes/reflectModule/ClassDefModule

ClassDefModule

scala.quoted.Quotes.reflectModule.ClassDefModule

Methods of the module objectval ClassDef

Attributes

Source
Quotes.scala
Graph
Supertypes
classObject
traitMatchable
classAny
Self type
Quotes.this.reflectModule.this.ClassDef.type

Members list

Value members

Abstract methods

defcopy(original:Quotes.this.reflectModule.this.Tree)(name:String,constr:Quotes.this.reflectModule.this.DefDef,parents:List[Quotes.this.reflectModule.this.Tree],selfOpt:Option[Quotes.this.reflectModule.this.ValDef],body:List[Quotes.this.reflectModule.this.Statement]):Quotes.this.reflectModule.this.ClassDef

Attributes

Source
Quotes.scala

Experimental methods

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 ofcls.

cls

The class symbol. A new class symbol can be created usingSymbol.newClass.

parents

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.

Attributes

Experimental
true
Source
Quotes.scala
defmodule(module:Quotes.this.reflectModule.this.Symbol,parents:List[Quotes.this.reflectModule.this.Tree],body:List[Quotes.this.reflectModule.this.Statement]): (Quotes.this.reflectModule.this.ValDef,Quotes.this.reflectModule.this.ClassDef)

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)

Value parameters

body

body of the module class

module

the module symbol (created usingSymbol.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
Source
Quotes.scala
In this article
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL

[8]ページ先頭

©2009-2025 Movatter.jp