mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
addmod and mulmod for why3.
This commit is contained in:
parent
82a6ab486d
commit
806507d5c0
@ -465,11 +465,25 @@ bool Why3Translator::visit(FunctionCall const& _node)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
FunctionType const& function = dynamic_cast<FunctionType const&>(*_node.expression().annotation().type);
|
FunctionType const& function = dynamic_cast<FunctionType const&>(*_node.expression().annotation().type);
|
||||||
if (function.location() != FunctionType::Location::Internal)
|
switch (function.location())
|
||||||
{
|
{
|
||||||
error(_node, "Only internal function calls supported.");
|
case FunctionType::Location::AddMod:
|
||||||
return true;
|
case FunctionType::Location::MulMod:
|
||||||
|
{
|
||||||
|
//@todo require that third parameter is not zero
|
||||||
|
add("(of_int (mod (Int.(");
|
||||||
|
add(function.location() == FunctionType::Location::AddMod ? "+" : "*");
|
||||||
|
add(") (to_int ");
|
||||||
|
_node.arguments().at(0)->accept(*this);
|
||||||
|
add(") (to_int ");
|
||||||
|
_node.arguments().at(1)->accept(*this);
|
||||||
|
add(")) (to_int ");
|
||||||
|
_node.arguments().at(2)->accept(*this);
|
||||||
|
add(")))");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
case FunctionType::Location::Internal:
|
||||||
|
{
|
||||||
if (!_node.names().empty())
|
if (!_node.names().empty())
|
||||||
{
|
{
|
||||||
error(_node, "Function calls with named arguments not supported.");
|
error(_node, "Function calls with named arguments not supported.");
|
||||||
@ -489,6 +503,11 @@ bool Why3Translator::visit(FunctionCall const& _node)
|
|||||||
add(")");
|
add(")");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
default:
|
||||||
|
error(_node, "Only internal function calls supported.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool Why3Translator::visit(MemberAccess const& _node)
|
bool Why3Translator::visit(MemberAccess const& _node)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user