mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4062 from ethereum/revert-variable
Fix revert with reason coming from a string variable
This commit is contained in:
@@ -89,7 +89,6 @@ void CompilerUtils::revertWithStringData(Type const& _argumentType)
|
||||
abiEncode({_argumentType.shared_from_this()}, {make_shared<ArrayType>(DataLocation::Memory, true)});
|
||||
toSizeAfterFreeMemoryPointer();
|
||||
m_context << Instruction::REVERT;
|
||||
m_context.adjustStackOffset(_argumentType.sizeOnStack());
|
||||
}
|
||||
|
||||
unsigned CompilerUtils::loadFromMemory(
|
||||
|
||||
@@ -933,7 +933,11 @@ bool ExpressionCompiler::visit(FunctionCall const& _functionCall)
|
||||
// condition was not met, flag an error
|
||||
m_context.appendInvalid();
|
||||
else if (arguments.size() > 1)
|
||||
{
|
||||
utils().revertWithStringData(*arguments.at(1)->annotation().type);
|
||||
// Here, the argument is consumed, but in the other branch, it is still there.
|
||||
m_context.adjustStackOffset(arguments.at(1)->annotation().type->sizeOnStack());
|
||||
}
|
||||
else
|
||||
m_context.appendRevert();
|
||||
// the success branch
|
||||
|
||||
Reference in New Issue
Block a user