mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow invoking the same modifier multiple times.
This commit is contained in:
1 parent
b83f77e0e5
commit
5a75581f66
5 files changed
+41
No files matched your search
@@ -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--;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user