diff options
author | chriseth <c@ethdev.com> | 2015-06-06 07:04:55 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2015-06-07 18:51:15 +0800 |
commit | c2a9419e495e931a825e8146aec49ffc34e44954 (patch) | |
tree | a6674b16ad95fe108794e305abddc7981c1bed79 /CompilerUtils.cpp | |
parent | b51ef4a357b4b60fc01038b0e97280fb9ecca01e (diff) | |
download | dexon-solidity-c2a9419e495e931a825e8146aec49ffc34e44954.tar.gz dexon-solidity-c2a9419e495e931a825e8146aec49ffc34e44954.tar.zst dexon-solidity-c2a9419e495e931a825e8146aec49ffc34e44954.zip |
Improved "Stack too deep" error message.
Closes #2080.
Diffstat (limited to 'CompilerUtils.cpp')
-rw-r--r-- | CompilerUtils.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/CompilerUtils.cpp b/CompilerUtils.cpp index e3d8f7f9..3549ef98 100644 --- a/CompilerUtils.cpp +++ b/CompilerUtils.cpp @@ -142,22 +142,25 @@ void CompilerUtils::moveToStackVariable(VariableDeclaration const& _variable) solAssert(stackPosition >= size, "Variable size and position mismatch."); // move variable starting from its top end in the stack if (stackPosition - size + 1 > 16) - BOOST_THROW_EXCEPTION(CompilerError() << errinfo_sourceLocation(_variable.getLocation()) - << errinfo_comment("Stack too deep.")); + BOOST_THROW_EXCEPTION( + CompilerError() << + errinfo_sourceLocation(_variable.getLocation()) << + errinfo_comment("Stack too deep, try removing local variables.") + ); for (unsigned i = 0; i < size; ++i) m_context << eth::swapInstruction(stackPosition - size + 1) << eth::Instruction::POP; } void CompilerUtils::copyToStackTop(unsigned _stackDepth, unsigned _itemSize) { - solAssert(_stackDepth <= 16, "Stack too deep."); + solAssert(_stackDepth <= 16, "Stack too deep, try removing local variables."); for (unsigned i = 0; i < _itemSize; ++i) m_context << eth::dupInstruction(_stackDepth); } void CompilerUtils::moveToStackTop(unsigned _stackDepth) { - solAssert(_stackDepth <= 15, "Stack too deep."); + solAssert(_stackDepth <= 15, "Stack too deep, try removing local variables."); for (unsigned i = 0; i < _stackDepth; ++i) m_context << eth::swapInstruction(1 + i); } |