Disallow invoking the same modifier multiple times.

This commit is contained in:
chriseth committed 2017-06-23 20:12:22 +02:00
1 parent b83f77e0e5
commit 5a75581f66
5 files changed
+41

No files matched your search

+4
View File
@@ -879,6 +879,7 @@ void ContractCompiler::appendModifierOrFunctionCode()
solAssert(m_currentFunction, "");
unsigned stackSurplus = 0;
Block const* codeBlock = nullptr;
vector<VariableDeclaration const*> addedVariables;
m_modifierDepth++;
@@ -902,6 +903,7 @@ void ContractCompiler::appendModifierOrFunctionCode()
for (unsigned i = 0; i < modifier.parameters().size(); ++i)
{
m_context.addVariable(*modifier.parameters()[i]);
addedVariables.push_back(modifier.parameters()[i].get());
compileExpression(
*modifierInvocation->arguments()[i],
modifier.parameters()[i]->annotation().type
@@ -928,6 +930,8 @@ void ContractCompiler::appendModifierOrFunctionCode()
m_returnTags.pop_back();
CompilerUtils(m_context).popStackSlots(stackSurplus);
for (auto var: addedVariables)
m_context.removeVariable(*var);
}
m_modifierDepth--;
}