mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Use options struct for function type factory function.
This commit is contained in:
@@ -1247,6 +1247,38 @@ public:
|
||||
/// Cannot be called.
|
||||
Declaration,
|
||||
};
|
||||
struct Options
|
||||
{
|
||||
/// true iff the function takes an arbitrary number of arguments of arbitrary types
|
||||
bool arbitraryParameters = false;
|
||||
/// true iff the gas value to be used is on the stack
|
||||
bool gasSet = false;
|
||||
/// true iff the value to be sent is on the stack
|
||||
bool valueSet = false;
|
||||
/// iff the salt value (for create2) to be used is on the stack
|
||||
bool saltSet = false;
|
||||
/// true iff the function is called as arg1.fun(arg2, ..., argn).
|
||||
/// This is achieved through the "using for" directive.
|
||||
bool bound = false;
|
||||
|
||||
static Options withArbitraryParameters()
|
||||
{
|
||||
Options result;
|
||||
result.arbitraryParameters = true;
|
||||
return result;
|
||||
}
|
||||
static Options fromFunctionType(FunctionType const& _type)
|
||||
{
|
||||
Options result;
|
||||
result.arbitraryParameters = _type.takesArbitraryParameters();
|
||||
result.gasSet = _type.gasSet();
|
||||
result.valueSet = _type.valueSet();
|
||||
result.saltSet = _type.saltSet();
|
||||
result.bound = _type.bound();
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/// Creates the type of a function.
|
||||
/// @arg _kind must be Kind::Internal, Kind::External or Kind::Declaration.
|
||||
|
||||
Reference in New Issue
Block a user