diff options
author | Daniel Kirchner <daniel@ekpyron.org> | 2018-04-10 20:05:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-10 20:05:06 +0800 |
commit | 2bc4ec31e2526abac57ac2864fa5c4bc4a7cd3a1 (patch) | |
tree | f92b9aa6f448523fca1730e7441f52d56a621e93 /libsolidity/codegen/ContractCompiler.cpp | |
parent | 0546a36acadee769b2f7ab6b86a1cf2e1da860ba (diff) | |
parent | 3eedbc6a9c60888dd967d6673a34511947da4aa1 (diff) | |
download | dexon-solidity-2bc4ec31e2526abac57ac2864fa5c4bc4a7cd3a1.tar dexon-solidity-2bc4ec31e2526abac57ac2864fa5c4bc4a7cd3a1.tar.gz dexon-solidity-2bc4ec31e2526abac57ac2864fa5c4bc4a7cd3a1.tar.bz2 dexon-solidity-2bc4ec31e2526abac57ac2864fa5c4bc4a7cd3a1.tar.lz dexon-solidity-2bc4ec31e2526abac57ac2864fa5c4bc4a7cd3a1.tar.xz dexon-solidity-2bc4ec31e2526abac57ac2864fa5c4bc4a7cd3a1.tar.zst dexon-solidity-2bc4ec31e2526abac57ac2864fa5c4bc4a7cd3a1.zip |
Merge pull request #3853 from ethereum/modifierStyleWithoutParentheses
Modifier style constructor calls without parentheses are an error.
Diffstat (limited to 'libsolidity/codegen/ContractCompiler.cpp')
-rw-r--r-- | libsolidity/codegen/ContractCompiler.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp index 3ca0b69d..5cb37103 100644 --- a/libsolidity/codegen/ContractCompiler.cpp +++ b/libsolidity/codegen/ContractCompiler.cpp @@ -222,7 +222,7 @@ void ContractCompiler::appendBaseConstructor(FunctionDefinition const& _construc if (auto inheritanceSpecifier = dynamic_cast<InheritanceSpecifier const*>(baseArgumentNode)) arguments = inheritanceSpecifier->arguments(); else if (auto modifierInvocation = dynamic_cast<ModifierInvocation const*>(baseArgumentNode)) - arguments = &modifierInvocation->arguments(); + arguments = modifierInvocation->arguments(); solAssert(arguments, ""); solAssert(arguments->size() == constructorType.parameterTypes().size(), ""); for (unsigned i = 0; i < arguments->size(); ++i) @@ -897,13 +897,16 @@ void ContractCompiler::appendModifierOrFunctionCode() ); ModifierDefinition const& modifier = m_context.resolveVirtualFunctionModifier(nonVirtualModifier); CompilerContext::LocationSetter locationSetter(m_context, modifier); - solAssert(modifier.parameters().size() == modifierInvocation->arguments().size(), ""); + std::vector<ASTPointer<Expression>> const& modifierArguments = + modifierInvocation->arguments() ? *modifierInvocation->arguments() : std::vector<ASTPointer<Expression>>(); + + solAssert(modifier.parameters().size() == modifierArguments.size(), ""); 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], + *modifierArguments[i], modifier.parameters()[i]->annotation().type ); } |