diff options
author | Lefteris Karapetsas <lefteris@refu.co> | 2015-01-29 23:39:30 +0800 |
---|---|---|
committer | Lefteris Karapetsas <lefteris@refu.co> | 2015-01-30 00:11:13 +0800 |
commit | e77fc5c7e0df59e86df848f7ec88a419fdd66183 (patch) | |
tree | fd1ee1c8f1e38831dbd0c8da1bfc49b7598ec998 | |
parent | d6e77f193a83a83659749c17af173590550cd170 (diff) | |
download | dexon-solidity-e77fc5c7e0df59e86df848f7ec88a419fdd66183.tar dexon-solidity-e77fc5c7e0df59e86df848f7ec88a419fdd66183.tar.gz dexon-solidity-e77fc5c7e0df59e86df848f7ec88a419fdd66183.tar.bz2 dexon-solidity-e77fc5c7e0df59e86df848f7ec88a419fdd66183.tar.lz dexon-solidity-e77fc5c7e0df59e86df848f7ec88a419fdd66183.tar.xz dexon-solidity-e77fc5c7e0df59e86df848f7ec88a419fdd66183.tar.zst dexon-solidity-e77fc5c7e0df59e86df848f7ec88a419fdd66183.zip |
Contract Interface Functions now return FunctionType
- Enchanced Function Type by declaration so that it can provide all the
required information at each place interface functions are consumed
- Changed all places where interface functions was used.
- Simplified Mix's FunctionDefinition code
-rw-r--r-- | SolidityNameAndTypeResolution.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/SolidityNameAndTypeResolution.cpp b/SolidityNameAndTypeResolution.cpp index 5ae854bc..26406e1f 100644 --- a/SolidityNameAndTypeResolution.cpp +++ b/SolidityNameAndTypeResolution.cpp @@ -93,8 +93,8 @@ static ContractDefinition const* retrieveContract(ASTPointer<SourceUnit> _source return NULL; } -static FunctionDescription const& retrieveFunctionBySignature(ContractDefinition const* _contract, - std::string const& _signature) +static std::shared_ptr<FunctionType const> const& retrieveFunctionBySignature(ContractDefinition const* _contract, + std::string const& _signature) { FixedHash<4> hash(dev::sha3(_signature)); return _contract->getInterfaceFunctions()[hash]; @@ -643,11 +643,11 @@ BOOST_AUTO_TEST_CASE(state_variable_accessors) ContractDefinition const* contract; BOOST_CHECK_NO_THROW(source = parseTextAndResolveNamesWithChecks(text)); BOOST_REQUIRE((contract = retrieveContract(source, 0)) != nullptr); - FunctionDescription function = retrieveFunctionBySignature(contract, "foo()"); - BOOST_REQUIRE(function.getDeclaration() != nullptr); - auto returnParams = function.getReturnParameters(); - BOOST_CHECK_EQUAL(returnParams.at(0).getType(), "uint256"); - BOOST_CHECK(function.isConstant()); + std::shared_ptr<FunctionType const> function = retrieveFunctionBySignature(contract, "foo()"); + BOOST_CHECK_MESSAGE(function->getDeclaration() != nullptr, "Could not find the accessor function"); + auto returnParams = function->getReturnParameterTypeNames(); + BOOST_CHECK_EQUAL(returnParams.at(0), "uint256"); + BOOST_CHECK(function->isConstant()); } BOOST_AUTO_TEST_CASE(function_clash_with_state_variable_accessor) @@ -676,8 +676,8 @@ BOOST_AUTO_TEST_CASE(private_state_variable) ContractDefinition const* contract; BOOST_CHECK_NO_THROW(source = parseTextAndResolveNamesWithChecks(text)); BOOST_CHECK((contract = retrieveContract(source, 0)) != nullptr); - FunctionDescription function = retrieveFunctionBySignature(contract, "foo()"); - BOOST_CHECK_MESSAGE(function.getDeclaration() == nullptr, "Accessor function of a private variable should not exist"); + FunctionTypePointer function = retrieveFunctionBySignature(contract, "foo()"); + BOOST_CHECK_MESSAGE(function == nullptr, "Accessor function of a private variable should not exist"); } BOOST_AUTO_TEST_SUITE_END() |