Fix develop 060 merge

This commit is contained in:
Leonardo Alt 2019-11-20 13:09:29 +01:00
parent 389da5228e
commit 72eff30778
5 changed files with 22 additions and 22 deletions

View File

@ -83,7 +83,7 @@ Json::Value AsmJsonConverter::operator()(Assignment const& _node) const
Json::Value ret = createAstNode(_node.location, "YulAssignment");
for (auto const& var: _node.variableNames)
ret["variableNames"].append((*this)(var));
ret["value"] = _node.value ? boost::apply_visitor(*this, *_node.value) : Json::nullValue;
ret["value"] = _node.value ? std::visit(*this, *_node.value) : Json::nullValue;
return ret;
}
@ -98,7 +98,7 @@ Json::Value AsmJsonConverter::operator()(FunctionCall const& _node) const
Json::Value AsmJsonConverter::operator()(ExpressionStatement const& _node) const
{
Json::Value ret = createAstNode(_node.location, "YulExpressionStatement");
ret["expression"] = boost::apply_visitor(*this, _node.expression);
ret["expression"] = std::visit(*this, _node.expression);
return ret;
}
@ -108,7 +108,7 @@ Json::Value AsmJsonConverter::operator()(VariableDeclaration const& _node) const
for (auto const& var: _node.variables)
ret["variables"].append((*this)(var));
ret["value"] = _node.value ? boost::apply_visitor(*this, *_node.value) : Json::nullValue;
ret["value"] = _node.value ? std::visit(*this, *_node.value) : Json::nullValue;
return ret;
}
@ -130,7 +130,7 @@ Json::Value AsmJsonConverter::operator()(If const& _node) const
{
solAssert(_node.condition, "Invalid if condition.");
Json::Value ret = createAstNode(_node.location, "YulIf");
ret["condition"] = boost::apply_visitor(*this, *_node.condition);
ret["condition"] = std::visit(*this, *_node.condition);
ret["body"] = (*this)(_node.body);
return ret;
}
@ -139,7 +139,7 @@ Json::Value AsmJsonConverter::operator()(Switch const& _node) const
{
solAssert(_node.expression, "Invalid expression pointer.");
Json::Value ret = createAstNode(_node.location, "YulSwitch");
ret["expression"] = boost::apply_visitor(*this, *_node.expression);
ret["expression"] = std::visit(*this, *_node.expression);
for (auto const& var: _node.cases)
ret["cases"].append((*this)(var));
return ret;
@ -158,7 +158,7 @@ Json::Value AsmJsonConverter::operator()(ForLoop const& _node) const
solAssert(_node.condition, "Invalid for loop condition.");
Json::Value ret = createAstNode(_node.location, "YulForLoop");
ret["pre"] = (*this)(_node.pre);
ret["condition"] = boost::apply_visitor(*this, *_node.condition);
ret["condition"] = std::visit(*this, *_node.condition);
ret["post"] = (*this)(_node.post);
ret["body"] = (*this)(_node.body);
return ret;
@ -195,7 +195,7 @@ Json::Value AsmJsonConverter::vectorOfVariantsToJson(vector<T> const& _vec) cons
{
Json::Value ret{Json::arrayValue};
for (auto const& var: _vec)
ret.append(boost::apply_visitor(*this, var));
ret.append(std::visit(*this, var));
return ret;
}

View File

@ -466,11 +466,11 @@ Expression Parser::parseCall(Parser::ElementaryOperation&& _initialOp)
FunctionCall ret;
if (holds_alternative<Identifier>(_initialOp))
{
ret.functionName = std::move(boost::get<Identifier>(_initialOp));
ret.functionName = std::move(std::get<Identifier>(_initialOp));
ret.location = ret.functionName.location;
}
else if (holds_alternative<FunctionCall>(_initialOp))
ret = std::move(boost::get<FunctionCall>(_initialOp));
ret = std::move(std::get<FunctionCall>(_initialOp));
else
fatalParserError(
m_dialect.flavour == AsmFlavour::Yul ?

View File

@ -139,7 +139,7 @@ void ControlFlowSimplifier::operator()(Block& _block)
void ControlFlowSimplifier::operator()(FunctionDefinition& _funDef)
{
ASTModifier::operator()(_funDef);
if (!_funDef.body.statements.empty() && _funDef.body.statements.back().type() == typeid(Leave))
if (!_funDef.body.statements.empty() && holds_alternative<Leave>(_funDef.body.statements.back()))
_funDef.body.statements.pop_back();
}

View File

@ -158,7 +158,7 @@ TerminationFinder::ControlFlow TerminationFinder::controlFlowKind(Statement cons
return ControlFlow::Break;
else if (holds_alternative<Continue>(_statement))
return ControlFlow::Continue;
else if (_statement.type() == typeid(Leave))
else if (holds_alternative<Leave>(_statement))
return ControlFlow::Leave;
else
return ControlFlow::FlowOut;

View File

@ -41,7 +41,7 @@ namespace test
#define CHECK_DEPLOY_GAS(_gasNoOpt, _gasOpt, _evmVersion) \
do \
{ \
u256 ipfsCost = GasMeter::dataGas(dev::ipfsHash(m_compiler.metadata(m_compiler.lastContractName())), true); \
u256 ipfsCost = GasMeter::dataGas(dev::ipfsHash(m_compiler.metadata(m_compiler.lastContractName())), true, _evmVersion); \
u256 gasOpt{_gasOpt}; \
u256 gasNoOpt{_gasNoOpt}; \
u256 gas = m_optimiserSettings == OptimiserSettings::minimal() ? gasNoOpt : gasOpt; \
@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE(string_storage)
auto evmVersion = dev::test::Options::get().evmVersion();
if (evmVersion <= EVMVersion::byzantium())
CHECK_DEPLOY_GAS(134071, 130763, evmVersion);
CHECK_DEPLOY_GAS(134145, 130831, evmVersion);
// This is only correct on >=Constantinople.
else if (Options::get().useABIEncoderV2)
{
@ -107,28 +107,28 @@ BOOST_AUTO_TEST_CASE(string_storage)
{
// Costs with 0 are cases which cannot be triggered in tests.
if (evmVersion < EVMVersion::istanbul())
CHECK_DEPLOY_GAS(0, 127653, evmVersion);
CHECK_DEPLOY_GAS(0, 127721, evmVersion);
else
CHECK_DEPLOY_GAS(0, 113821, evmVersion);
CHECK_DEPLOY_GAS(0, 113993, evmVersion);
}
else
{
if (evmVersion < EVMVersion::istanbul())
CHECK_DEPLOY_GAS(0, 135371, evmVersion);
CHECK_DEPLOY_GAS(151523, 135371, evmVersion);
else
CHECK_DEPLOY_GAS(0, 120083, evmVersion);
CHECK_DEPLOY_GAS(134883, 120083, evmVersion);
}
}
else if (evmVersion < EVMVersion::istanbul())
CHECK_DEPLOY_GAS(126861, 119591, evmVersion);
CHECK_DEPLOY_GAS(126929, 119659, evmVersion);
else
CHECK_DEPLOY_GAS(114173, 107163, evmVersion);
CHECK_DEPLOY_GAS(114345, 107335, evmVersion);
if (evmVersion >= EVMVersion::byzantium())
{
callContractFunction("f()");
if (evmVersion == EVMVersion::byzantium())
CHECK_GAS(21551, 21526, 20);
CHECK_GAS(21545, 21526, 20);
// This is only correct on >=Constantinople.
else if (Options::get().useABIEncoderV2)
{
@ -142,9 +142,9 @@ BOOST_AUTO_TEST_CASE(string_storage)
else
{
if (evmVersion < EVMVersion::istanbul())
CHECK_GAS(0, 21635, 20);
CHECK_GAS(21707, 21635, 20);
else
CHECK_GAS(0, 21431, 20);
CHECK_GAS(21499, 21431, 20);
}
}
else if (evmVersion < EVMVersion::istanbul())