mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Adds support for arrays in function signatures.
This commit is contained in:
parent
9193fcb99f
commit
ab31c28ed9
@ -11,7 +11,7 @@ Bugfixes:
|
||||
|
||||
|
||||
Build System:
|
||||
|
||||
* Soltest: Add support for arrays in function signatures.
|
||||
|
||||
|
||||
### 0.5.5 (2019-03-05)
|
||||
|
@ -252,6 +252,15 @@ string TestFileParser::parseIdentifierOrTuple()
|
||||
{
|
||||
identOrTuple = m_scanner.currentLiteral();
|
||||
expect(Token::Identifier);
|
||||
while (accept(Token::LBrack))
|
||||
{
|
||||
identOrTuple += formatToken(Token::LBrack);
|
||||
expect(Token::LBrack);
|
||||
if (accept(Token::Number))
|
||||
identOrTuple += parseDecimalNumber();
|
||||
identOrTuple += formatToken(Token::RBrack);
|
||||
expect(Token::RBrack);
|
||||
}
|
||||
return identOrTuple;
|
||||
}
|
||||
expect(Token::LParen);
|
||||
@ -402,6 +411,12 @@ void TestFileParser::Scanner::scanNextToken()
|
||||
case ')':
|
||||
token = selectToken(Token::RParen);
|
||||
break;
|
||||
case '[':
|
||||
token = selectToken(Token::LBrack);
|
||||
break;
|
||||
case ']':
|
||||
token = selectToken(Token::RBrack);
|
||||
break;
|
||||
default:
|
||||
if (langutil::isIdentifierStart(current()))
|
||||
{
|
||||
|
@ -460,6 +460,20 @@ BOOST_AUTO_TEST_CASE(call_multiple_arguments_mixed_format)
|
||||
);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(call_signature_array)
|
||||
{
|
||||
char const* source = R"(
|
||||
// f(uint256[]) ->
|
||||
// f(uint256[3]) ->
|
||||
// f(uint256[3][][], uint8[9]) ->
|
||||
)";
|
||||
auto const calls = parse(source);
|
||||
BOOST_REQUIRE_EQUAL(calls.size(), 3);
|
||||
testFunctionCall(calls.at(0), Mode::SingleLine, "f(uint256[])", false);
|
||||
testFunctionCall(calls.at(1), Mode::SingleLine, "f(uint256[3])", false);
|
||||
testFunctionCall(calls.at(2), Mode::SingleLine, "f(uint256[3][][],uint8[9])", false);
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(call_signature_valid)
|
||||
{
|
||||
char const* source = R"(
|
||||
|
Loading…
Reference in New Issue
Block a user