aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-04-03 22:10:19 +0800
committerGitHub <noreply@github.com>2018-04-03 22:10:19 +0800
commit19f288774112c64331b55aca0f6519452dea2c74 (patch)
tree97539bd0526e6da954444ac4d9867c1197a219ec /libsolidity
parentd21382157cbda53d98f3a4e0d7c0d0a7d213aebf (diff)
parenta54fdc495f54bd16c329ca3f79d533d540cb9a3e (diff)
downloaddexon-solidity-19f288774112c64331b55aca0f6519452dea2c74.tar.gz
dexon-solidity-19f288774112c64331b55aca0f6519452dea2c74.tar.zst
dexon-solidity-19f288774112c64331b55aca0f6519452dea2c74.zip
Merge pull request #3757 from ethereum/fixEmptyBaseArguments
Fix: Treat empty base constructor argument list as not provided.
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/codegen/ContractCompiler.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/libsolidity/codegen/ContractCompiler.cpp b/libsolidity/codegen/ContractCompiler.cpp
index 791edc65..ebd9139a 100644
--- a/libsolidity/codegen/ContractCompiler.cpp
+++ b/libsolidity/codegen/ContractCompiler.cpp
@@ -143,8 +143,9 @@ void ContractCompiler::appendInitAndConstructorCode(ContractDefinition const& _c
for (auto const& modifier: constructor->modifiers())
{
auto baseContract = dynamic_cast<ContractDefinition const*>(
- modifier->name()->annotation().referencedDeclaration);
- if (baseContract)
+ modifier->name()->annotation().referencedDeclaration
+ );
+ if (baseContract && !modifier->arguments().empty())
if (m_baseArguments.count(baseContract->constructor()) == 0)
m_baseArguments[baseContract->constructor()] = &modifier->arguments();
}
@@ -156,7 +157,7 @@ void ContractCompiler::appendInitAndConstructorCode(ContractDefinition const& _c
);
solAssert(baseContract, "");
- if (m_baseArguments.count(baseContract->constructor()) == 0)
+ if (!m_baseArguments.count(baseContract->constructor()) && !base->arguments().empty())
m_baseArguments[baseContract->constructor()] = &base->arguments();
}
}
@@ -238,6 +239,7 @@ void ContractCompiler::appendBaseConstructor(FunctionDefinition const& _construc
solAssert(m_baseArguments.count(&_constructor), "");
std::vector<ASTPointer<Expression>> const* arguments = m_baseArguments[&_constructor];
solAssert(arguments, "");
+ solAssert(arguments->size() == constructorType.parameterTypes().size(), "");
for (unsigned i = 0; i < arguments->size(); ++i)
compileExpression(*(arguments->at(i)), constructorType.parameterTypes()[i]);
}