diff options
author | Lefteris Karapetsas <lefteris@refu.co> | 2015-01-30 23:06:56 +0800 |
---|---|---|
committer | Lefteris Karapetsas <lefteris@refu.co> | 2015-02-01 07:20:35 +0800 |
commit | c742c09ae6d0dad39f5cbbc33e54aa7d182c85f5 (patch) | |
tree | 9eb336825aef4a8d8e4ee338039e0f228cf0a185 | |
parent | 69fa5db47144dbe4f1272d29fe75149262671d5f (diff) | |
download | dexon-solidity-c742c09ae6d0dad39f5cbbc33e54aa7d182c85f5.tar dexon-solidity-c742c09ae6d0dad39f5cbbc33e54aa7d182c85f5.tar.gz dexon-solidity-c742c09ae6d0dad39f5cbbc33e54aa7d182c85f5.tar.bz2 dexon-solidity-c742c09ae6d0dad39f5cbbc33e54aa7d182c85f5.tar.lz dexon-solidity-c742c09ae6d0dad39f5cbbc33e54aa7d182c85f5.tar.xz dexon-solidity-c742c09ae6d0dad39f5cbbc33e54aa7d182c85f5.tar.zst dexon-solidity-c742c09ae6d0dad39f5cbbc33e54aa7d182c85f5.zip |
Adding mapping treatment to FunctionType
Plus a TypeResolution test for it
-rw-r--r-- | SolidityNameAndTypeResolution.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/SolidityNameAndTypeResolution.cpp b/SolidityNameAndTypeResolution.cpp index b9a7140f..df0e07e1 100644 --- a/SolidityNameAndTypeResolution.cpp +++ b/SolidityNameAndTypeResolution.cpp @@ -637,6 +637,7 @@ BOOST_AUTO_TEST_CASE(state_variable_accessors) " uint64(2);\n" " }\n" "uint256 foo;\n" + "mapping(uint=>string4) map;\n" "}\n"; ASTPointer<SourceUnit> source; @@ -644,10 +645,17 @@ BOOST_AUTO_TEST_CASE(state_variable_accessors) BOOST_CHECK_NO_THROW(source = parseTextAndResolveNamesWithChecks(text)); BOOST_REQUIRE((contract = retrieveContract(source, 0)) != nullptr); FunctionTypePointer function = retrieveFunctionBySignature(contract, "foo()"); - BOOST_REQUIRE(function->hasDeclaration()); + BOOST_REQUIRE(function && function->hasDeclaration()); auto returnParams = function->getReturnParameterTypeNames(); BOOST_CHECK_EQUAL(returnParams.at(0), "uint256"); BOOST_CHECK(function->isConstant()); + function = retrieveFunctionBySignature(contract, "map(uint256)"); + BOOST_REQUIRE(function && function->hasDeclaration()); + auto Params = function->getParameterTypeNames(); + BOOST_CHECK_EQUAL(returnParams.at(0), "uint256"); + returnParams = function->getReturnParameterTypeNames(); + BOOST_CHECK_EQUAL(returnParams.at(0), "string4"); + BOOST_CHECK(function->isConstant()); } BOOST_AUTO_TEST_CASE(function_clash_with_state_variable_accessor) |