mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Support payable keyword for functions
This commit is contained in:
committed by
chriseth
parent
e2b787cdd0
commit
a34f2f1a31
@@ -540,6 +540,7 @@ public:
|
||||
bool _isDeclaredConst,
|
||||
std::vector<ASTPointer<ModifierInvocation>> const& _modifiers,
|
||||
ASTPointer<ParameterList> const& _returnParameters,
|
||||
bool _isPayable,
|
||||
ASTPointer<Block> const& _body
|
||||
):
|
||||
CallableDeclaration(_location, _name, _visibility, _parameters, _returnParameters),
|
||||
@@ -547,6 +548,7 @@ public:
|
||||
ImplementationOptional(_body != nullptr),
|
||||
m_isConstructor(_isConstructor),
|
||||
m_isDeclaredConst(_isDeclaredConst),
|
||||
m_isPayable(_isPayable),
|
||||
m_functionModifiers(_modifiers),
|
||||
m_body(_body)
|
||||
{}
|
||||
@@ -556,6 +558,7 @@ public:
|
||||
|
||||
bool isConstructor() const { return m_isConstructor; }
|
||||
bool isDeclaredConst() const { return m_isDeclaredConst; }
|
||||
bool isPayable() const { return m_isPayable; }
|
||||
std::vector<ASTPointer<ModifierInvocation>> const& modifiers() const { return m_functionModifiers; }
|
||||
std::vector<ASTPointer<VariableDeclaration>> const& returnParameters() const { return m_returnParameters->parameters(); }
|
||||
Block const& body() const { return *m_body; }
|
||||
@@ -578,6 +581,7 @@ public:
|
||||
private:
|
||||
bool m_isConstructor;
|
||||
bool m_isDeclaredConst;
|
||||
bool m_isPayable;
|
||||
std::vector<ASTPointer<ModifierInvocation>> m_functionModifiers;
|
||||
ASTPointer<Block> m_body;
|
||||
};
|
||||
|
||||
@@ -1653,6 +1653,7 @@ TypePointer TupleType::closestTemporaryType(TypePointer const& _targetType) cons
|
||||
FunctionType::FunctionType(FunctionDefinition const& _function, bool _isInternal):
|
||||
m_location(_isInternal ? Location::Internal : Location::External),
|
||||
m_isConstant(_function.isDeclaredConst()),
|
||||
m_isPayable(_function.isPayable()),
|
||||
m_declaration(&_function)
|
||||
{
|
||||
TypePointers params;
|
||||
|
||||
@@ -905,6 +905,7 @@ public:
|
||||
}
|
||||
bool hasDeclaration() const { return !!m_declaration; }
|
||||
bool isConstant() const { return m_isConstant; }
|
||||
bool isPayable() const { return m_isPayable; }
|
||||
/// @return A shared pointer of an ASTString.
|
||||
/// Can contain a nullptr in which case indicates absence of documentation
|
||||
ASTPointer<ASTString> documentation() const;
|
||||
@@ -942,6 +943,7 @@ private:
|
||||
bool const m_valueSet = false; ///< true iff the value to be sent is on the stack
|
||||
bool const m_bound = false; ///< true iff the function is called as arg1.fun(arg2, ..., argn)
|
||||
bool m_isConstant = false;
|
||||
bool m_isPayable = false;
|
||||
Declaration const* m_declaration = nullptr;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user