mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Simplify StackTooDeepError in Yul
This commit is contained in:
parent
a993ab4db7
commit
9230faf9a3
@ -483,8 +483,10 @@ void CodeTransform::operator()(FunctionDefinition const& _function)
|
|||||||
|
|
||||||
if (stackLayout.size() > 17)
|
if (stackLayout.size() > 17)
|
||||||
{
|
{
|
||||||
StackTooDeepError error(_function.name, YulString{}, static_cast<int>(stackLayout.size()) - 17);
|
StackTooDeepError error(
|
||||||
error << errinfo_comment(
|
_function.name,
|
||||||
|
YulString{},
|
||||||
|
static_cast<int>(stackLayout.size()) - 17,
|
||||||
"The function " +
|
"The function " +
|
||||||
_function.name.str() +
|
_function.name.str() +
|
||||||
" has " +
|
" has " +
|
||||||
@ -716,8 +718,9 @@ size_t CodeTransform::variableHeightDiff(Scope::Variable const& _var, YulString
|
|||||||
size_t limit = _forSwap ? 17 : 16;
|
size_t limit = _forSwap ? 17 : 16;
|
||||||
if (heightDiff > limit)
|
if (heightDiff > limit)
|
||||||
{
|
{
|
||||||
m_stackErrors.emplace_back(_varName, heightDiff - limit);
|
m_stackErrors.emplace_back(
|
||||||
m_stackErrors.back() << errinfo_comment(
|
_varName,
|
||||||
|
heightDiff - limit,
|
||||||
"Variable " +
|
"Variable " +
|
||||||
_varName.str() +
|
_varName.str() +
|
||||||
" is " +
|
" is " +
|
||||||
|
@ -43,10 +43,16 @@ class EVMAssembly;
|
|||||||
|
|
||||||
struct StackTooDeepError: virtual YulException
|
struct StackTooDeepError: virtual YulException
|
||||||
{
|
{
|
||||||
StackTooDeepError(YulString _variable, int _depth): variable(_variable), depth(_depth) {}
|
StackTooDeepError(YulString _variable, int _depth, std::string const& _message):
|
||||||
StackTooDeepError(YulString _functionName, YulString _variable, int _depth):
|
variable(_variable), depth(_depth)
|
||||||
|
{
|
||||||
|
*this << util::errinfo_comment(_message);
|
||||||
|
}
|
||||||
|
StackTooDeepError(YulString _functionName, YulString _variable, int _depth, std::string const& _message):
|
||||||
functionName(_functionName), variable(_variable), depth(_depth)
|
functionName(_functionName), variable(_variable), depth(_depth)
|
||||||
{}
|
{
|
||||||
|
*this << util::errinfo_comment(_message);
|
||||||
|
}
|
||||||
YulString functionName;
|
YulString functionName;
|
||||||
YulString variable;
|
YulString variable;
|
||||||
int depth;
|
int depth;
|
||||||
|
Loading…
Reference in New Issue
Block a user