aboutsummaryrefslogtreecommitdiffstats
path: root/CompilerContext.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-12-17 23:23:18 +0800
committerChristian <c@ethdev.com>2014-12-17 23:24:56 +0800
commit5a1a83ff42b97f85e06c54c7d5fe7db2f8239e5a (patch)
tree3aaf794ca4352fedfb7b651a5722b3ff2a588e1b /CompilerContext.cpp
parent3d98ec1323f604130c0dba87ce4596f04ffa0269 (diff)
downloaddexon-solidity-5a1a83ff42b97f85e06c54c7d5fe7db2f8239e5a.tar.gz
dexon-solidity-5a1a83ff42b97f85e06c54c7d5fe7db2f8239e5a.tar.zst
dexon-solidity-5a1a83ff42b97f85e06c54c7d5fe7db2f8239e5a.zip
Assertions that throw InternalCompilerErrors.
Diffstat (limited to 'CompilerContext.cpp')
-rw-r--r--CompilerContext.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/CompilerContext.cpp b/CompilerContext.cpp
index 47401436..18357bf0 100644
--- a/CompilerContext.cpp
+++ b/CompilerContext.cpp
@@ -27,8 +27,10 @@
using namespace std;
-namespace dev {
-namespace solidity {
+namespace dev
+{
+namespace solidity
+{
void CompilerContext::addMagicGlobal(MagicVariableDeclaration const& _declaration)
{
@@ -65,8 +67,7 @@ void CompilerContext::addFunction(FunctionDefinition const& _function)
bytes const& CompilerContext::getCompiledContract(const ContractDefinition& _contract) const
{
auto ret = m_compiledContracts.find(&_contract);
- if (asserts(ret != m_compiledContracts.end()))
- BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Compiled contract not found."));
+ solAssert(ret != m_compiledContracts.end(), "Compiled contract not found.");
return *ret->second;
}
@@ -78,16 +79,14 @@ bool CompilerContext::isLocalVariable(Declaration const* _declaration) const
eth::AssemblyItem CompilerContext::getFunctionEntryLabel(FunctionDefinition const& _function) const
{
auto res = m_functionEntryLabels.find(&_function);
- if (asserts(res != m_functionEntryLabels.end()))
- BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Function entry label not found."));
+ solAssert(res != m_functionEntryLabels.end(), "Function entry label not found.");
return res->second.tag();
}
unsigned CompilerContext::getBaseStackOffsetOfVariable(Declaration const& _declaration) const
{
auto res = m_localVariables.find(&_declaration);
- if (asserts(res != m_localVariables.end()))
- BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Variable not found on stack."));
+ solAssert(res != m_localVariables.end(), "Variable not found on stack.");
return m_localVariablesSize - res->second - 1;
}
@@ -99,12 +98,9 @@ unsigned CompilerContext::baseToCurrentStackOffset(unsigned _baseOffset) const
u256 CompilerContext::getStorageLocationOfVariable(const Declaration& _declaration) const
{
auto it = m_stateVariables.find(&_declaration);
- if (it == m_stateVariables.end())
- BOOST_THROW_EXCEPTION(InternalCompilerError() << errinfo_comment("Variable not found in storage."));
+ solAssert(it != m_stateVariables.end(), "Variable not found in storage.");
return it->second;
}
-
-
}
}