aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLefteris Karapetsas <lefteris@refu.co>2015-03-12 19:25:07 +0800
committerLefteris Karapetsas <lefteris@refu.co>2015-03-12 19:53:01 +0800
commit3d0f4b0f228126c6636001ae5f4ec425fac5cb0f (patch)
tree01fd05d064a4318496050a7a1e300cf47f78b2de
parent0b411d98e9aea631bfbbf10e870800363e8f20dc (diff)
downloaddexon-solidity-3d0f4b0f228126c6636001ae5f4ec425fac5cb0f.tar
dexon-solidity-3d0f4b0f228126c6636001ae5f4ec425fac5cb0f.tar.gz
dexon-solidity-3d0f4b0f228126c6636001ae5f4ec425fac5cb0f.tar.bz2
dexon-solidity-3d0f4b0f228126c6636001ae5f4ec425fac5cb0f.tar.lz
dexon-solidity-3d0f4b0f228126c6636001ae5f4ec425fac5cb0f.tar.xz
dexon-solidity-3d0f4b0f228126c6636001ae5f4ec425fac5cb0f.tar.zst
dexon-solidity-3d0f4b0f228126c6636001ae5f4ec425fac5cb0f.zip
Style fixes and some additional hash to bytes32 renaming
-rw-r--r--SolidityEndToEndTest.cpp2
-rw-r--r--SolidityParser.cpp32
2 files changed, 17 insertions, 17 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp
index 1492f03c..5f95709c 100644
--- a/SolidityEndToEndTest.cpp
+++ b/SolidityEndToEndTest.cpp
@@ -519,7 +519,7 @@ BOOST_AUTO_TEST_CASE(strings)
BOOST_CHECK(callContractFunction("fixed()") == encodeArgs(string("abc\0\xff__", 7)));
BOOST_CHECK(callContractFunction("pipeThrough(bytes2,bool)", string("\0\x02", 2), true) == encodeArgs(string("\0\x2", 2), true));
}
-#
+
BOOST_AUTO_TEST_CASE(empty_string_on_stack)
{
char const* sourceCode = "contract test {\n"
diff --git a/SolidityParser.cpp b/SolidityParser.cpp
index 608e1707..cfdb3f95 100644
--- a/SolidityParser.cpp
+++ b/SolidityParser.cpp
@@ -83,7 +83,7 @@ BOOST_AUTO_TEST_CASE(empty_function)
{
char const* text = "contract test {\n"
" uint256 stateVar;\n"
- " function functionName(hash160 arg1, address addr) constant\n"
+ " function functionName(bytes20 arg1, address addr) constant\n"
" returns (int id)\n"
" { }\n"
"}\n";
@@ -103,7 +103,7 @@ BOOST_AUTO_TEST_CASE(single_function_param)
{
char const* text = "contract test {\n"
" uint256 stateVar;\n"
- " function functionName(hash hashin) returns (hash hashout) {}\n"
+ " function functionName(bytes32 in) returns (bytes32 out) {}\n"
"}\n";
ETH_TEST_CHECK_NO_THROW(parseText(text), "Parsing failed.");
}
@@ -133,7 +133,7 @@ BOOST_AUTO_TEST_CASE(function_natspec_documentation)
char const* text = "contract test {\n"
" uint256 stateVar;\n"
" /// This is a test function\n"
- " function functionName(hash hashin) returns (hash hashout) {}\n"
+ " function functionName(bytes32 in) returns (bytes32 out) {}\n"
"}\n";
ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed");
auto functions = contract->getDefinedFunctions();
@@ -148,7 +148,7 @@ BOOST_AUTO_TEST_CASE(function_normal_comments)
char const* text = "contract test {\n"
" uint256 stateVar;\n"
" // We won't see this comment\n"
- " function functionName(hash hashin) returns (hash hashout) {}\n"
+ " function functionName(bytes32 in) returns (bytes32 out) {}\n"
"}\n";
ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed");
auto functions = contract->getDefinedFunctions();
@@ -164,13 +164,13 @@ BOOST_AUTO_TEST_CASE(multiple_functions_natspec_documentation)
char const* text = "contract test {\n"
" uint256 stateVar;\n"
" /// This is test function 1\n"
- " function functionName1(hash hashin) returns (hash hashout) {}\n"
+ " function functionName1(bytes32 in) returns (bytes32 out) {}\n"
" /// This is test function 2\n"
- " function functionName2(hash hashin) returns (hash hashout) {}\n"
+ " function functionName2(bytes32 in) returns (bytes32 out) {}\n"
" // nothing to see here\n"
- " function functionName3(hash hashin) returns (hash hashout) {}\n"
+ " function functionName3(bytes32 in) returns (bytes32 out) {}\n"
" /// This is test function 4\n"
- " function functionName4(hash hashin) returns (hash hashout) {}\n"
+ " function functionName4(bytes32 in) returns (bytes32 out) {}\n"
"}\n";
ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed");
auto functions = contract->getDefinedFunctions();
@@ -197,7 +197,7 @@ BOOST_AUTO_TEST_CASE(multiline_function_documentation)
" uint256 stateVar;\n"
" /// This is a test function\n"
" /// and it has 2 lines\n"
- " function functionName1(hash hashin) returns (hash hashout) {}\n"
+ " function functionName1(bytes32 in) returns (bytes32 out) {}\n"
"}\n";
ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed");
auto functions = contract->getDefinedFunctions();
@@ -217,12 +217,12 @@ BOOST_AUTO_TEST_CASE(natspec_comment_in_function_body)
" var b;\n"
" /// I should not interfere with actual natspec comments\n"
" uint256 c;\n"
- " mapping(address=>hash) d;\n"
+ " mapping(address=>bytes32) d;\n"
" string name = \"Solidity\";"
" }\n"
" /// This is a test function\n"
" /// and it has 2 lines\n"
- " function fun(hash hashin) returns (hash hashout) {}\n"
+ " function fun(bytes32 in) returns (bytes32 out) {}\n"
"}\n";
ETH_TEST_REQUIRE_NO_THROW(contract = parseText(text), "Parsing failed");
auto functions = contract->getDefinedFunctions();
@@ -246,7 +246,7 @@ BOOST_AUTO_TEST_CASE(natspec_docstring_between_keyword_and_signature)
" var b;\n"
" /// I should not interfere with actual natspec comments\n"
" uint256 c;\n"
- " mapping(address=>hash) d;\n"
+ " mapping(address=>bytes32) d;\n"
" string name = \"Solidity\";"
" }\n"
"}\n";
@@ -269,7 +269,7 @@ BOOST_AUTO_TEST_CASE(natspec_docstring_after_signature)
" var b;\n"
" /// I should not interfere with actual natspec comments\n"
" uint256 c;\n"
- " mapping(address=>hash) d;\n"
+ " mapping(address=>bytes32) d;\n"
" string name = \"Solidity\";"
" }\n"
"}\n";
@@ -330,7 +330,7 @@ BOOST_AUTO_TEST_CASE(variable_definition)
" function fun(uint256 a) {\n"
" var b;\n"
" uint256 c;\n"
- " mapping(address=>hash) d;\n"
+ " mapping(address=>bytes32) d;\n"
" customtype varname;\n"
" }\n"
"}\n";
@@ -343,7 +343,7 @@ BOOST_AUTO_TEST_CASE(variable_definition_with_initialization)
" function fun(uint256 a) {\n"
" var b = 2;\n"
" uint256 c = 0x87;\n"
- " mapping(address=>hash) d;\n"
+ " mapping(address=>bytes32) d;\n"
" string name = \"Solidity\";"
" customtype varname;\n"
" }\n"
@@ -366,7 +366,7 @@ BOOST_AUTO_TEST_CASE(variable_definition_in_mapping)
char const* text = R"(
contract test {
function fun() {
- mapping(var=>hash) d;
+ mapping(var=>bytes32) d;
}
}
)";