mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Support revert()
This commit is contained in:
parent
148f923351
commit
f3158f92d6
@ -67,7 +67,9 @@ m_magicVariables(vector<shared_ptr<MagicVariableDeclaration const>>{make_shared<
|
||||
make_shared<MagicVariableDeclaration>("ripemd160",
|
||||
make_shared<FunctionType>(strings(), strings{"bytes20"}, FunctionType::Location::RIPEMD160, true)),
|
||||
make_shared<MagicVariableDeclaration>("assert",
|
||||
make_shared<FunctionType>(strings{"bool"}, strings{}, FunctionType::Location::Assert))})
|
||||
make_shared<FunctionType>(strings{"bool"}, strings{}, FunctionType::Location::Assert)),
|
||||
make_shared<MagicVariableDeclaration>("revert",
|
||||
make_shared<FunctionType>(strings(), strings(), FunctionType::Location::Revert))})
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -2095,6 +2095,7 @@ string FunctionType::identifier() const
|
||||
case Location::Send: id += "send"; break;
|
||||
case Location::SHA3: id += "sha3"; break;
|
||||
case Location::Selfdestruct: id += "selfdestruct"; break;
|
||||
case Location::Revert: id += "revert"; break;
|
||||
case Location::ECRecover: id += "ecrecover"; break;
|
||||
case Location::SHA256: id += "sha256"; break;
|
||||
case Location::RIPEMD160: id += "ripemd160"; break;
|
||||
|
@ -828,6 +828,7 @@ public:
|
||||
Send, ///< CALL, but without data and gas
|
||||
SHA3, ///< SHA3
|
||||
Selfdestruct, ///< SELFDESTRUCT
|
||||
Revert, ///< REVERT
|
||||
ECRecover, ///< CALL to special contract for ecrecover
|
||||
SHA256, ///< CALL to special contract for sha256
|
||||
RIPEMD160, ///< CALL to special contract for ripemd160
|
||||
|
@ -650,6 +650,11 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
|
||||
utils().convertType(*arguments.front()->annotation().type, *function.parameterTypes().front(), true);
|
||||
m_context << Instruction::SELFDESTRUCT;
|
||||
break;
|
||||
case Location::Revert:
|
||||
// memory offset returned - zero length
|
||||
m_context << u256(0) << u256(0);
|
||||
m_context << Instruction::REVERT;
|
||||
break;
|
||||
case Location::SHA3:
|
||||
{
|
||||
TypePointers argumentTypes;
|
||||
|
Loading…
Reference in New Issue
Block a user