aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity/SolidityParser.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-06-05 17:07:50 +0800
committerchriseth <c@ethdev.com>2015-06-05 20:44:05 +0800
commit7aff1fb942c7a9b5a5fa04e886336db737337d0d (patch)
tree7807f91a31962268caaac99b7508f605acbe8ed6 /libsolidity/SolidityParser.cpp
parent8ba801ec0e885ebca5babadef007f20bcdde1f0b (diff)
downloaddexon-solidity-7aff1fb942c7a9b5a5fa04e886336db737337d0d.tar.gz
dexon-solidity-7aff1fb942c7a9b5a5fa04e886336db737337d0d.tar.zst
dexon-solidity-7aff1fb942c7a9b5a5fa04e886336db737337d0d.zip
Ability to specify the storage location of a reference type.
Diffstat (limited to 'libsolidity/SolidityParser.cpp')
-rw-r--r--libsolidity/SolidityParser.cpp41
1 files changed, 41 insertions, 0 deletions
diff --git a/libsolidity/SolidityParser.cpp b/libsolidity/SolidityParser.cpp
index cad0e1f2..438e650b 100644
--- a/libsolidity/SolidityParser.cpp
+++ b/libsolidity/SolidityParser.cpp
@@ -873,6 +873,47 @@ BOOST_AUTO_TEST_CASE(var_array)
BOOST_CHECK_THROW(parseText(text), ParserError);
}
+BOOST_AUTO_TEST_CASE(location_specifiers_for_params)
+{
+ char const* text = R"(
+ contract Foo {
+ function f(uint[] storage constant x, uint[] memory y) { }
+ }
+ )";
+ BOOST_CHECK_NO_THROW(parseText(text));
+}
+
+BOOST_AUTO_TEST_CASE(location_specifiers_for_locals)
+{
+ char const* text = R"(
+ contract Foo {
+ function f() {
+ uint[] storage x;
+ uint[] memory y;
+ }
+ }
+ )";
+ BOOST_CHECK_NO_THROW(parseText(text));
+}
+
+BOOST_AUTO_TEST_CASE(location_specifiers_for_state)
+{
+ char const* text = R"(
+ contract Foo {
+ uint[] memory x;
+ })";
+ BOOST_CHECK_THROW(parseText(text), ParserError);
+}
+
+BOOST_AUTO_TEST_CASE(location_specifiers_with_var)
+{
+ char const* text = R"(
+ contract Foo {
+ function f() { var memory x; }
+ })";
+ BOOST_CHECK_THROW(parseText(text), ParserError);
+}
+
BOOST_AUTO_TEST_SUITE_END()
}