mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Enforce commas in tuple syntax
This commit is contained in:
parent
5b26e2bcee
commit
a8c047f48d
@ -6,6 +6,7 @@ Features:
|
|||||||
* Metadata: Store experimental flag in metadata CBOR.
|
* Metadata: Store experimental flag in metadata CBOR.
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
* Parser: Enforce commas between array and tuple elements.
|
||||||
|
|
||||||
### 0.4.15 (2017-08-08)
|
### 0.4.15 (2017-08-08)
|
||||||
|
|
||||||
|
@ -1300,10 +1300,11 @@ ASTPointer<Expression> Parser::parsePrimaryExpression()
|
|||||||
parserError("Expected expression (inline array elements cannot be omitted).");
|
parserError("Expected expression (inline array elements cannot be omitted).");
|
||||||
else
|
else
|
||||||
components.push_back(ASTPointer<Expression>());
|
components.push_back(ASTPointer<Expression>());
|
||||||
|
|
||||||
if (m_scanner->currentToken() == oppositeToken)
|
if (m_scanner->currentToken() == oppositeToken)
|
||||||
break;
|
break;
|
||||||
else if (m_scanner->currentToken() == Token::Comma)
|
|
||||||
m_scanner->next();
|
expectToken(Token::Comma);
|
||||||
}
|
}
|
||||||
nodeFactory.markEndPosition();
|
nodeFactory.markEndPosition();
|
||||||
expectToken(oppositeToken);
|
expectToken(oppositeToken);
|
||||||
|
@ -1187,6 +1187,18 @@ BOOST_AUTO_TEST_CASE(tuples)
|
|||||||
BOOST_CHECK(successParse(text));
|
BOOST_CHECK(successParse(text));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOST_AUTO_TEST_CASE(tuples_without_commas)
|
||||||
|
{
|
||||||
|
char const* text = R"(
|
||||||
|
contract C {
|
||||||
|
function f() {
|
||||||
|
var a = (2 2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)";
|
||||||
|
CHECK_PARSE_ERROR(text, "Expected token Comma");
|
||||||
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(member_access_parser_ambiguity)
|
BOOST_AUTO_TEST_CASE(member_access_parser_ambiguity)
|
||||||
{
|
{
|
||||||
char const* text = R"(
|
char const* text = R"(
|
||||||
|
Loading…
Reference in New Issue
Block a user