aboutsummaryrefslogtreecommitdiffstats
path: root/CompilerContext.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-02-23 02:15:41 +0800
committerChristian <c@ethdev.com>2015-02-24 01:25:49 +0800
commit754c804d191ad8f05d886566e599a82efbd38d8e (patch)
tree3872af65523e734487f9ef2eb605ae0329d0caa2 /CompilerContext.cpp
parent3abbb8d625bd3a904c54dfda7558a77d5543ac70 (diff)
downloaddexon-solidity-754c804d191ad8f05d886566e599a82efbd38d8e.tar
dexon-solidity-754c804d191ad8f05d886566e599a82efbd38d8e.tar.gz
dexon-solidity-754c804d191ad8f05d886566e599a82efbd38d8e.tar.bz2
dexon-solidity-754c804d191ad8f05d886566e599a82efbd38d8e.tar.lz
dexon-solidity-754c804d191ad8f05d886566e599a82efbd38d8e.tar.xz
dexon-solidity-754c804d191ad8f05d886566e599a82efbd38d8e.tar.zst
dexon-solidity-754c804d191ad8f05d886566e599a82efbd38d8e.zip
Implementation of index access.
Diffstat (limited to 'CompilerContext.cpp')
-rw-r--r--CompilerContext.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/CompilerContext.cpp b/CompilerContext.cpp
index 01a71d7c..8d32a1a5 100644
--- a/CompilerContext.cpp
+++ b/CompilerContext.cpp
@@ -40,7 +40,12 @@ void CompilerContext::addMagicGlobal(MagicVariableDeclaration const& _declaratio
void CompilerContext::addStateVariable(VariableDeclaration const& _declaration)
{
m_stateVariables[&_declaration] = m_stateVariablesSize;
- m_stateVariablesSize += _declaration.getType()->getStorageSize();
+ bigint newSize = bigint(m_stateVariablesSize) + _declaration.getType()->getStorageSize();
+ if (newSize >= bigint(1) << 256)
+ BOOST_THROW_EXCEPTION(TypeError()
+ << errinfo_comment("State variable does not fit in storage.")
+ << errinfo_sourceLocation(_declaration.getLocation()));
+ m_stateVariablesSize = u256(newSize);
}
void CompilerContext::startFunction(Declaration const& _function)