mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add more tests and assertions
This commit is contained in:
@@ -127,6 +127,8 @@ void CompilerContext::addVariable(VariableDeclaration const& _declaration,
|
||||
unsigned _offsetToCurrent)
|
||||
{
|
||||
solAssert(m_asm->deposit() >= 0 && unsigned(m_asm->deposit()) >= _offsetToCurrent, "");
|
||||
unsigned sizeOnStack = _declaration.annotation().type->sizeOnStack();
|
||||
solAssert(sizeOnStack == 1 || sizeOnStack == 2, "");
|
||||
m_localVariables[&_declaration].push_back(unsigned(m_asm->deposit()) - _offsetToCurrent);
|
||||
}
|
||||
|
||||
|
||||
@@ -1172,6 +1172,7 @@ void CompilerUtils::popStackSlots(size_t _amount)
|
||||
|
||||
void CompilerUtils::popAndJump(unsigned _toHeight, eth::AssemblyItem const& _jumpTo)
|
||||
{
|
||||
solAssert(m_context.stackHeight() >= _toHeight, "");
|
||||
unsigned amount = m_context.stackHeight() - _toHeight;
|
||||
popStackSlots(amount);
|
||||
m_context.appendJumpTo(_jumpTo);
|
||||
|
||||
@@ -999,6 +999,7 @@ eth::AssemblyPointer ContractCompiler::cloneRuntime() const
|
||||
void ContractCompiler::popScopedVariables(ASTNode const* _node)
|
||||
{
|
||||
unsigned blockHeight = m_scopeStackHeight.at(m_modifierDepth).at(_node);
|
||||
solAssert(m_context.stackHeight() >= blockHeight, "");
|
||||
unsigned stackDiff = m_context.stackHeight() - blockHeight;
|
||||
CompilerUtils(m_context).popStackSlots(stackDiff);
|
||||
m_context.removeVariablesAboveStackHeight(blockHeight);
|
||||
|
||||
Reference in New Issue
Block a user