mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2460 from ethereum/disallowMultiModifier
Disallow invoking the same modifier multiple times.
This commit is contained in:
commit
a0b0df2d98
5 files changed
+41
No files matched your search
@@ -878,6 +878,7 @@ void ContractCompiler::appendModifierOrFunctionCode()
|
||||
solAssert(m_currentFunction, "");
|
||||
unsigned stackSurplus = 0;
|
||||
Block const* codeBlock = nullptr;
|
||||
vector<VariableDeclaration const*> addedVariables;
|
||||
|
||||
m_modifierDepth++;
|
||||
|
||||
@@ -901,6 +902,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
|
||||
@@ -927,6 +929,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