mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Crash fix, parseTypeName can return null.
This commit is contained in:
parent
d15cde2aa8
commit
122e65f8f4
@ -5,6 +5,8 @@ Features:
|
|||||||
* Type Checker: Warn on using literals as tight packing parameters in ``keccak256``, ``sha3``, ``sha256`` and ``ripemd160``.
|
* Type Checker: Warn on using literals as tight packing parameters in ``keccak256``, ``sha3``, ``sha256`` and ``ripemd160``.
|
||||||
|
|
||||||
Bugfixes:
|
Bugfixes:
|
||||||
|
* Parser: Crash fix related to parseTypeName.
|
||||||
|
|
||||||
|
|
||||||
### 0.4.16 (2017-08-24)
|
### 0.4.16 (2017-08-24)
|
||||||
|
|
||||||
|
@ -1244,7 +1244,10 @@ ASTPointer<Expression> Parser::parseLeftHandSideExpression(
|
|||||||
{
|
{
|
||||||
expectToken(Token::New);
|
expectToken(Token::New);
|
||||||
ASTPointer<TypeName> typeName(parseTypeName(false));
|
ASTPointer<TypeName> typeName(parseTypeName(false));
|
||||||
nodeFactory.setEndPositionFromNode(typeName);
|
if (typeName)
|
||||||
|
nodeFactory.setEndPositionFromNode(typeName);
|
||||||
|
else
|
||||||
|
nodeFactory.markEndPosition();
|
||||||
expression = nodeFactory.createNode<NewExpression>(typeName);
|
expression = nodeFactory.createNode<NewExpression>(typeName);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1602,6 +1602,18 @@ BOOST_AUTO_TEST_CASE(interface)
|
|||||||
BOOST_CHECK(successParse(text));
|
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()
|
BOOST_AUTO_TEST_SUITE_END()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user