aboutsummaryrefslogtreecommitdiffstats
path: root/CompilerContext.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-11-05 21:20:56 +0800
committerChristian <c@ethdev.com>2014-11-05 22:01:24 +0800
commitc1f7a1665f17c5f9865534c7a26827cfbf6f3dd5 (patch)
tree758fd6ffa201c101c272e8d671697c65acf294b8 /CompilerContext.cpp
parent1de66d6e9ea5ad04f96247895a867be53e42da7c (diff)
downloaddexon-solidity-c1f7a1665f17c5f9865534c7a26827cfbf6f3dd5.tar.gz
dexon-solidity-c1f7a1665f17c5f9865534c7a26827cfbf6f3dd5.tar.zst
dexon-solidity-c1f7a1665f17c5f9865534c7a26827cfbf6f3dd5.zip
Converted all asserts to exceptions.
Diffstat (limited to 'CompilerContext.cpp')
-rw-r--r--CompilerContext.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/CompilerContext.cpp b/CompilerContext.cpp
index b8f57618..44d0844c 100644
--- a/CompilerContext.cpp
+++ b/CompilerContext.cpp
@@ -20,7 +20,6 @@
* Utilities for the solidity compiler.
*/
-#include <cassert>
#include <utility>
#include <numeric>
#include <libsolidity/AST.h>
@@ -45,14 +44,16 @@ void CompilerContext::initializeLocalVariables(unsigned _numVariables)
int CompilerContext::getStackPositionOfVariable(const Declaration& _declaration)
{
auto res = find(begin(m_localVariables), end(m_localVariables), &_declaration);
- assert(res != m_localVariables.end());
+ if (asserts(res != m_localVariables.end()))
+ BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Variable not found on stack."));
return end(m_localVariables) - res - 1 + m_asm.deposit();
}
eth::AssemblyItem CompilerContext::getFunctionEntryLabel(const FunctionDefinition& _function) const
{
auto res = m_functionEntryLabels.find(&_function);
- assert(res != m_functionEntryLabels.end());
+ if (asserts(res != m_functionEntryLabels.end()))
+ BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Function entry label not found."));
return res->second.tag();
}