aboutsummaryrefslogtreecommitdiffstats
path: root/AST.cpp
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2015-01-14 01:12:19 +0800
committerChristian <c@ethdev.com>2015-01-14 01:12:30 +0800
commitb440d7e321793e0b053d3b467934a45f880863e0 (patch)
tree9144aea74cfd5c67188bd9a75ba9fb1673c0e0b1 /AST.cpp
parentec022783c4ba2a319ce60dc818e4f0e0e8872093 (diff)
downloaddexon-solidity-b440d7e321793e0b053d3b467934a45f880863e0.tar.gz
dexon-solidity-b440d7e321793e0b053d3b467934a45f880863e0.tar.zst
dexon-solidity-b440d7e321793e0b053d3b467934a45f880863e0.zip
Specify value for contract creation.
Diffstat (limited to 'AST.cpp')
-rw-r--r--AST.cpp15
1 files changed, 4 insertions, 11 deletions
diff --git a/AST.cpp b/AST.cpp
index d171006a..66de5995 100644
--- a/AST.cpp
+++ b/AST.cpp
@@ -309,20 +309,13 @@ bool FunctionCall::isTypeConversion() const
void NewExpression::checkTypeRequirements()
{
m_contractName->checkTypeRequirements();
- for (ASTPointer<Expression> const& argument: m_arguments)
- argument->checkTypeRequirements();
-
m_contract = dynamic_cast<ContractDefinition const*>(m_contractName->getReferencedDeclaration());
if (!m_contract)
BOOST_THROW_EXCEPTION(createTypeError("Identifier is not a contract."));
- shared_ptr<ContractType const> type = make_shared<ContractType>(*m_contract);
- m_type = type;
- TypePointers const& parameterTypes = type->getConstructorType()->getParameterTypes();
- if (parameterTypes.size() != m_arguments.size())
- BOOST_THROW_EXCEPTION(createTypeError("Wrong argument count for constructor call."));
- for (size_t i = 0; i < m_arguments.size(); ++i)
- if (!m_arguments[i]->getType()->isImplicitlyConvertibleTo(*parameterTypes[i]))
- BOOST_THROW_EXCEPTION(createTypeError("Invalid type for argument in constructor call."));
+ shared_ptr<ContractType const> contractType = make_shared<ContractType>(*m_contract);
+ TypePointers const& parameterTypes = contractType->getConstructorType()->getParameterTypes();
+ m_type = make_shared<FunctionType>(parameterTypes, TypePointers{contractType},
+ FunctionType::Location::CREATION);
}
void MemberAccess::checkTypeRequirements()