mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #2834 from ethereum/fixTypeNameParsing
Crash fix, parseTypeName can return null.
This commit is contained in:
commit
1beef38361
@ -5,6 +5,8 @@ Features:
|
||||
* Type Checker: Warn on using literals as tight packing parameters in ``keccak256``, ``sha3``, ``sha256`` and ``ripemd160``.
|
||||
|
||||
Bugfixes:
|
||||
* Parser: Crash fix related to parseTypeName.
|
||||
|
||||
|
||||
### 0.4.16 (2017-08-24)
|
||||
|
||||
|
@ -1244,7 +1244,10 @@ ASTPointer<Expression> Parser::parseLeftHandSideExpression(
|
||||
{
|
||||
expectToken(Token::New);
|
||||
ASTPointer<TypeName> typeName(parseTypeName(false));
|
||||
nodeFactory.setEndPositionFromNode(typeName);
|
||||
if (typeName)
|
||||
nodeFactory.setEndPositionFromNode(typeName);
|
||||
else
|
||||
nodeFactory.markEndPosition();
|
||||
expression = nodeFactory.createNode<NewExpression>(typeName);
|
||||
}
|
||||
else
|
||||
|
@ -1602,6 +1602,18 @@ BOOST_AUTO_TEST_CASE(interface)
|
||||
BOOST_CHECK(successParse(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(newInvalidTypeName)
|
||||
{
|
||||
char const* text = R"(
|
||||
contract C {
|
||||
function f() {
|
||||
new var;
|
||||
}
|
||||
}
|
||||
)";
|
||||
CHECK_PARSE_ERROR(text, "Expected explicit type name");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_SUITE_END()
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user