A function declaration or definition.
If the definition
is missing or a specifier, then the statement
must be terminated by a semicolon; if it’s a Block
, the semicolon is not necessary.
Examples:
shared formal Boolean equals(Object that); function compareByLength({Anything*} first, {Anything*} second) => first.length.compare(second.length); shared void run() { print("Hello, `` process.arguments.first else "World" ``!");
Anything
AnyFunction
TypedDeclaration
Declaration
Node
Object
Anything
Initializer |
AnyFunction() |
Attributes | |
children | Source Codeshared formal [Annotations, Type|FunctionModifier|DynamicModifier|VoidModifier, LIdentifier, <TypeParameters|Parameters|TypeConstraint|Block|LazySpecifier>*] children The child nodes of this node. Refines Node.children |
definition | Source Codeshared formal Block|LazySpecifier? definition The function definition. Refines TypedDeclaration.definition |
name | Source Codeshared formal MemberName name The function name. |
parameterLists | Source Codeshared formal [Parameters+] parameterLists The parameter lists. A function must have at least one, but may also have several parameter lists. |
type | Source Codeshared formal Type|FunctionModifier|DynamicModifier|VoidModifier type The type of the function. This can be:
(A function declaration without definition may not use
a ‘ Refines TypedDeclaration.type |
typeConstraints | Source Codeshared formal TypeConstraint[] typeConstraints The type constraints placed upon the function’s type parameters, if any. |
typeParameters | Source Codeshared formal TypeParameters? typeParameters The type parameters of the function, if any. |
Inherited Attributes |
Attributes inherited from: Declaration |
Attributes inherited from: Node |
Attributes inherited from: Object hash , string |
Attributes inherited from: TypedDeclaration |
Inherited Methods |
Methods inherited from: Node |
Methods inherited from: Object equals |