A constructor definition.

A constructor may be either a callable constructor or a value constructor.

Examples (multi-line):

// 2D point
shared new polar(r, φ) {
    Float r;
    Float φ;
    this.x = r * cos(φ);
    this.y = r * sin(φ);
    this.r = r;
    this.φ = φ;
}

shared new origin {
    x = 0.0; y = 0.0;
    r = 0.0; φ = 0.0;
}
Initializer
ConstructorDefinition()
Attributes
blockshared formal Block block

The block of the constructor.

childrenshared formal <Annotations|LIdentifier|Parameters|ExtendedType|Block>[] children

The child nodes of this node.

extendedTypeshared formal ExtendedType? extendedType

The extended type of the constructor, if present.

nameshared formal LIdentifier? name

The name of the constructor, if present.

An absent name is only allowed for a callable constructor, in which case it is the default constructor.

parametersshared formal Parameters? parameters

The parameters of the constructor, if applicable.

Callable constructors have parameters, value constructors do not.

Inherited Attributes
Attributes inherited from: Declaration
Attributes inherited from: Node
Attributes inherited from: Object
hash, string
Inherited Methods
Methods inherited from: Node
Methods inherited from: Object
equals