ValDefModule
Methods of the module object val ValDef.
Attributes
- Source
- Quotes.scala
- Graph
-
- Supertypes
- Self type
-
Members list
Value members
Abstract methods
Creates a value definition val x, var x or lazy val x with the signature defined in the symbol.
Creates a value definition val x, var x or lazy val x with the signature defined in the symbol.
The rhs should return Some containing the implementation of the method, or None if the method has no implementation. Any definition directly inside the implementation should have symbol as owner.
Use Symbol.asQuotes to create the rhs using quoted code.
See also: Tree.changeOwner
Value parameters
- rhs
-
Somecontaining the right-hand side term, orNonefor abstract values - symbol
-
the val/var/lazy val symbol (created using
Symbol.newVal)
Attributes
- Returns
-
a new
ValDeftree for the given symbol - Source
- Quotes.scala
Attributes
- Source
- Quotes.scala
Creates a block { val = ; }
Creates a block { val = ; }
Usage:
ValDef.let(owner, "x", rhs1, Flags.Lazy) { x =>
ValDef.let(x.symbol.owner, "y", rhs2, Flags.Mutable) { y =>
// use `x` and `y`
}
}
Value parameters
- body
-
a function that takes a reference to the bound value and returns the body term
- flags
-
extra flags to with which the symbol should be constructed. Can be
Final | Implicit | Lazy | Mutable | Given | Synthetic - name
-
the name of the
valbinding - owner
-
the owner symbol for the generated
valdefinition - rhs
-
the right-hand side term to bind
Attributes
- Returns
-
a block containing the
valdefinition and the body - Source
- Quotes.scala
Creates a block { val = ; }
Creates a block { val = ; }
Usage:
ValDef.let(owner, "x", rhs1) { x =>
ValDef.let(x.symbol.owner, "y", rhs2) { y =>
// use `x` and `y`
}
}
Value parameters
- body
-
a function that takes a reference to the bound value and returns the body term
- name
-
the name of the
valbinding - owner
-
the owner symbol for the generated
valdefinition - rhs
-
the right-hand side term to bind
Attributes
- Returns
-
a block containing the
valdefinition and the body - Source
- Quotes.scala
Creates a block { val x1 = ; ...; val xn = ; }
Creates a block { val x1 = ; ...; val xn = ; }
Usage:
ValDef.let(owner, rhsList) { xs =>
...
}
Value parameters
- body
-
a function that takes references to all bound values and returns the body term
- owner
-
the owner symbol for the generated
valdefinitions - terms
-
the list of right-hand side terms to bind
Attributes
- Returns
-
a block containing all
valdefinitions and the body - Source
- Quotes.scala
Attributes
- Source
- Quotes.scala
Concrete methods
Creates a block { val x = ; }
Creates a block { val x = ; }
Usage:
ValDef.let(owner, rhs1) { x =>
ValDef.let(owner, rhs2) { y =>
// use `x` and `y`
}
}
Value parameters
- body
-
a function that takes a reference to the bound value and returns the body term
- owner
-
the owner symbol for the generated
valdefinition - rhs
-
the right-hand side term to bind
Attributes
- Returns
-
a block containing the
valdefinition and the body - Source
- Quotes.scala