aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian <c@ethdev.com>2014-10-14 00:22:15 +0800
committerChristian <c@ethdev.com>2014-10-16 00:40:19 +0800
commitde155c13efcfa0b88b17fd8eb297b660d99ffcc0 (patch)
treee83e8c509fe0fefd5b64dfef77c07c5a2f7bb9f7
parent082d79dba43645400a36f191231ba4b0e2b4c929 (diff)
downloaddexon-solidity-de155c13efcfa0b88b17fd8eb297b660d99ffcc0.tar
dexon-solidity-de155c13efcfa0b88b17fd8eb297b660d99ffcc0.tar.gz
dexon-solidity-de155c13efcfa0b88b17fd8eb297b660d99ffcc0.tar.bz2
dexon-solidity-de155c13efcfa0b88b17fd8eb297b660d99ffcc0.tar.lz
dexon-solidity-de155c13efcfa0b88b17fd8eb297b660d99ffcc0.tar.xz
dexon-solidity-de155c13efcfa0b88b17fd8eb297b660d99ffcc0.tar.zst
dexon-solidity-de155c13efcfa0b88b17fd8eb297b660d99ffcc0.zip
Type system, not yet complete.
-rw-r--r--solidityNameAndTypeResolution.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/solidityNameAndTypeResolution.cpp b/solidityNameAndTypeResolution.cpp
index 568025e5..5a938e46 100644
--- a/solidityNameAndTypeResolution.cpp
+++ b/solidityNameAndTypeResolution.cpp
@@ -49,7 +49,7 @@ BOOST_AUTO_TEST_CASE(smoke_test)
{
char const* text = "contract test {\n"
" uint256 stateVariable1;\n"
- " function fun(uint256 arg1) { var x = 2; uint256 y = 3; x = 1; }"
+ " function fun(uint256 arg1) { var x; uint256 y; }"
"}\n";
BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text));
}
@@ -66,8 +66,8 @@ BOOST_AUTO_TEST_CASE(double_stateVariable_declaration)
BOOST_AUTO_TEST_CASE(double_function_declaration)
{
char const* text = "contract test {\n"
- " function fun() { var x = 2; }\n"
- " function fun() { var y = 9; }\n"
+ " function fun() { var x; }\n"
+ " function fun() { var x; }\n"
"}\n";
BOOST_CHECK_THROW(parseTextAndResolveNames(text), std::exception);
}
@@ -75,7 +75,7 @@ BOOST_AUTO_TEST_CASE(double_function_declaration)
BOOST_AUTO_TEST_CASE(double_variable_declaration)
{
char const* text = "contract test {\n"
- " function f() { uint256 x = 9; if (true) { uint256 x = 2;} x = 3; }\n"
+ " function f() { uint256 x; if (true) { uint256 x; } }\n"
"}\n";
BOOST_CHECK_THROW(parseTextAndResolveNames(text), std::exception);
}
@@ -84,7 +84,7 @@ BOOST_AUTO_TEST_CASE(name_shadowing)
{
char const* text = "contract test {\n"
" uint256 variable;\n"
- " function f() { uint8 variable = 2; }"
+ " function f() { uint32 variable ; }"
"}\n";
BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text));
}
@@ -93,7 +93,7 @@ BOOST_AUTO_TEST_CASE(name_references)
{
char const* text = "contract test {\n"
" uint256 variable;\n"
- " function f() { variable = 2; f(); test; }"
+ " function f(uint256 arg) returns (uint out) { f(variable); test; out; }"
"}\n";
BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text));
}
@@ -102,7 +102,7 @@ BOOST_AUTO_TEST_CASE(undeclared_name)
{
char const* text = "contract test {\n"
" uint256 variable;\n"
- " function f() { notfound = 2; }"
+ " function f(uint256 arg) { f(notfound); }"
"}\n";
BOOST_CHECK_THROW(parseTextAndResolveNames(text), std::exception);
}