31
31
#include < libsolutil/FunctionSelector.h>
32
32
#include < libevmasm/Instruction.h>
33
33
#include < libsolutil/Whiskers.h>
34
+ #include < libsolutil/StackTooDeepString.h>
34
35
35
36
using namespace std ;
36
37
using namespace solidity ;
@@ -476,7 +477,7 @@ void CompilerUtils::encodeToMemory(
476
477
assertThrow (
477
478
(argSize + dynPointers) < 16 ,
478
479
StackTooDeepError,
479
- " Stack too deep, try using fewer variables. "
480
+ util::stackTooDeepString
480
481
);
481
482
}
482
483
else
@@ -537,7 +538,7 @@ void CompilerUtils::encodeToMemory(
537
538
assertThrow (
538
539
(2 + dynPointers) <= 16 ,
539
540
StackTooDeepError,
540
- " Stack too deep( " + to_string ( 2 + dynPointers) + " ), try using fewer variables. "
541
+ util::stackTooDeepString
541
542
);
542
543
m_context << dupInstruction (2 + dynPointers) << Instruction::DUP2;
543
544
m_context << Instruction::SUB;
@@ -1418,7 +1419,7 @@ void CompilerUtils::moveToStackVariable(VariableDeclaration const& _variable)
1418
1419
BOOST_THROW_EXCEPTION (
1419
1420
StackTooDeepError () <<
1420
1421
errinfo_sourceLocation (_variable.location ()) <<
1421
- util::errinfo_comment (" Stack too deep, try removing local variables. " )
1422
+ util::errinfo_comment (util::stackTooDeepString )
1422
1423
);
1423
1424
for (unsigned i = 0 ; i < size; ++i)
1424
1425
m_context << swapInstruction (stackPosition - size + 1 ) << Instruction::POP;
@@ -1429,7 +1430,7 @@ void CompilerUtils::copyToStackTop(unsigned _stackDepth, unsigned _itemSize)
1429
1430
assertThrow (
1430
1431
_stackDepth <= 16 ,
1431
1432
StackTooDeepError,
1432
- " Stack too deep, try removing local variables. "
1433
+ util::stackTooDeepString
1433
1434
);
1434
1435
for (unsigned i = 0 ; i < _itemSize; ++i)
1435
1436
m_context << dupInstruction (_stackDepth);
@@ -1455,7 +1456,7 @@ void CompilerUtils::rotateStackUp(unsigned _items)
1455
1456
assertThrow (
1456
1457
_items - 1 <= 16 ,
1457
1458
StackTooDeepError,
1458
- " Stack too deep, try removing local variables. "
1459
+ util::stackTooDeepString
1459
1460
);
1460
1461
for (unsigned i = 1 ; i < _items; ++i)
1461
1462
m_context << swapInstruction (_items - i);
@@ -1466,7 +1467,7 @@ void CompilerUtils::rotateStackDown(unsigned _items)
1466
1467
assertThrow (
1467
1468
_items - 1 <= 16 ,
1468
1469
StackTooDeepError,
1469
- " Stack too deep, try removing local variables. "
1470
+ util::stackTooDeepString
1470
1471
);
1471
1472
for (unsigned i = 1 ; i < _items; ++i)
1472
1473
m_context << swapInstruction (i);
0 commit comments