diff options
author | Christian <c@ethdev.com> | 2014-11-25 21:43:23 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-11-26 22:35:25 +0800 |
commit | a2715c5f34cfa4050ba64b4a1467b9ca5821472b (patch) | |
tree | 699b649087db7c9b5c9eb000fb452d404af7c755 /AST.cpp | |
parent | 6e6b85b58a478a7e2bc0f8bee976df97f9861b91 (diff) | |
download | dexon-solidity-a2715c5f34cfa4050ba64b4a1467b9ca5821472b.tar dexon-solidity-a2715c5f34cfa4050ba64b4a1467b9ca5821472b.tar.gz dexon-solidity-a2715c5f34cfa4050ba64b4a1467b9ca5821472b.tar.bz2 dexon-solidity-a2715c5f34cfa4050ba64b4a1467b9ca5821472b.tar.lz dexon-solidity-a2715c5f34cfa4050ba64b4a1467b9ca5821472b.tar.xz dexon-solidity-a2715c5f34cfa4050ba64b4a1467b9ca5821472b.tar.zst dexon-solidity-a2715c5f34cfa4050ba64b4a1467b9ca5821472b.zip |
More general function types and references.
Diffstat (limited to 'AST.cpp')
-rw-r--r-- | AST.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -467,19 +467,19 @@ void FunctionCall::checkTypeRequirements() //@todo would be nice to create a struct type from the arguments // and then ask if that is implicitly convertible to the struct represented by the // function parameters - FunctionDefinition const& fun = dynamic_cast<FunctionType const&>(*expressionType).getFunction(); - vector<ASTPointer<VariableDeclaration>> const& parameters = fun.getParameters(); - if (parameters.size() != m_arguments.size()) + FunctionType const& functionType = dynamic_cast<FunctionType const&>(*expressionType); + TypePointers const& parameterTypes = functionType.getParameterTypes(); + if (parameterTypes.size() != m_arguments.size()) BOOST_THROW_EXCEPTION(createTypeError("Wrong argument count for function call.")); for (size_t i = 0; i < m_arguments.size(); ++i) - if (!m_arguments[i]->getType()->isImplicitlyConvertibleTo(*parameters[i]->getType())) + if (!m_arguments[i]->getType()->isImplicitlyConvertibleTo(*parameterTypes[i])) BOOST_THROW_EXCEPTION(createTypeError("Invalid type for argument in function call.")); // @todo actually the return type should be an anonymous struct, // but we change it to the type of the first return value until we have structs - if (fun.getReturnParameters().empty()) + if (functionType.getReturnParameterTypes().empty()) m_type = make_shared<VoidType>(); else - m_type = fun.getReturnParameters().front()->getType(); + m_type = functionType.getReturnParameterTypes().front(); } } |