mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Mention "payable" in the documentation.
This commit is contained in:
parent
e1df3bd77f
commit
f7a62c1e69
@ -291,7 +291,7 @@ be passed via and returned from external function calls.
|
|||||||
|
|
||||||
Function types are notated as follows:
|
Function types are notated as follows:
|
||||||
|
|
||||||
function (<parameter types>) {internal|external} [constant] [returns (<return types>)]
|
function (<parameter types>) {internal|external} [constant] [payable] [returns (<return types>)]
|
||||||
|
|
||||||
In contrast to the parameter types, the return types cannot be empty - if the
|
In contrast to the parameter types, the return types cannot be empty - if the
|
||||||
function type should not return anything, the whole ``returns (<return types>)``
|
function type should not return anything, the whole ``returns (<return types>)``
|
||||||
@ -300,8 +300,13 @@ part has to be omitted.
|
|||||||
By default, function types are internal, so the ``internal`` keyword can be
|
By default, function types are internal, so the ``internal`` keyword can be
|
||||||
omitted.
|
omitted.
|
||||||
|
|
||||||
|
There are two ways to access a function in the current contract: Either directly
|
||||||
|
by its name, ``f``, or using ``this.f``. The former will result in an internal
|
||||||
|
function, the latter in an external function.
|
||||||
|
|
||||||
If a function type variable is not initialized, calling it will result
|
If a function type variable is not initialized, calling it will result
|
||||||
in an exception.
|
in an exception. The same happens if you call a function after using ``delete``
|
||||||
|
on it.
|
||||||
|
|
||||||
If external function types are used outside of the context of Solidity,
|
If external function types are used outside of the context of Solidity,
|
||||||
they are converted into the ``bytes24`` type.
|
they are converted into the ``bytes24`` type.
|
||||||
|
@ -22,7 +22,7 @@ StructDefinition = 'struct' Identifier '{'
|
|||||||
( VariableDeclaration ';' (VariableDeclaration ';')* )? '}'
|
( VariableDeclaration ';' (VariableDeclaration ';')* )? '}'
|
||||||
ModifierDefinition = 'modifier' Identifier ParameterList? Block
|
ModifierDefinition = 'modifier' Identifier ParameterList? Block
|
||||||
FunctionDefinition = 'function' Identifier? ParameterList
|
FunctionDefinition = 'function' Identifier? ParameterList
|
||||||
( FunctionCall | Identifier | 'constant' | 'external' | 'public' | 'internal' | 'private' )*
|
( FunctionCall | Identifier | 'constant' |' payable' | 'external' | 'public' | 'internal' | 'private' )*
|
||||||
( 'returns' ParameterList )? Block
|
( 'returns' ParameterList )? Block
|
||||||
EventDefinition = 'event' Identifier IndexedParameterList 'anonymous'? ';'
|
EventDefinition = 'event' Identifier IndexedParameterList 'anonymous'? ';'
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ VariableDeclaration = TypeName Identifier
|
|||||||
TypeName = ElementaryTypeName | Identifier StorageLocation? | Mapping | ArrayTypeName | FunctionTypeName
|
TypeName = ElementaryTypeName | Identifier StorageLocation? | Mapping | ArrayTypeName | FunctionTypeName
|
||||||
Mapping = 'mapping' '(' ElementaryTypeName '=>' TypeName ')'
|
Mapping = 'mapping' '(' ElementaryTypeName '=>' TypeName ')'
|
||||||
ArrayTypeName = TypeName StorageLocation? '[' Expression? ']'
|
ArrayTypeName = TypeName StorageLocation? '[' Expression? ']'
|
||||||
FunctionTypeName = 'function' TypeNameList ( 'internal' | 'external' | 'constant' )*
|
FunctionTypeName = 'function' TypeNameList ( 'internal' | 'external' | 'constant' | 'payable' )*
|
||||||
( 'returns' TypeNameList )?
|
( 'returns' TypeNameList )?
|
||||||
StorageLocation = 'memory' | 'storage'
|
StorageLocation = 'memory' | 'storage'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user