From c1f7a1665f17c5f9865534c7a26827cfbf6f3dd5 Mon Sep 17 00:00:00 2001 From: Christian Date: Wed, 5 Nov 2014 14:20:56 +0100 Subject: Converted all asserts to exceptions. --- CompilerContext.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'CompilerContext.cpp') 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 #include #include #include @@ -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(); } -- cgit v1.2.3