mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #9965 from ethereum/var_is_reserved
Var is reserved keyword.
This commit is contained in:
commit
046cc42121
@ -318,7 +318,7 @@ namespace TokenTraits
|
||||
|
||||
constexpr bool isEtherSubdenomination(Token op) { return op >= Token::SubWei && op <= Token::SubEther; }
|
||||
constexpr bool isTimeSubdenomination(Token op) { return op == Token::SubSecond || op == Token::SubMinute || op == Token::SubHour || op == Token::SubDay || op == Token::SubWeek || op == Token::SubYear; }
|
||||
constexpr bool isReservedKeyword(Token op) { return (Token::After <= op && op <= Token::Unchecked); }
|
||||
constexpr bool isReservedKeyword(Token op) { return (Token::After <= op && op <= Token::Var); }
|
||||
|
||||
constexpr bool isYulKeyword(Token tok)
|
||||
{
|
||||
|
@ -121,6 +121,7 @@ BOOST_AUTO_TEST_CASE(reserved_keywords)
|
||||
BOOST_CHECK(!TokenTraits::isReservedKeyword(Token::Identifier));
|
||||
BOOST_CHECK(TokenTraits::isReservedKeyword(Token::After));
|
||||
BOOST_CHECK(TokenTraits::isReservedKeyword(Token::Unchecked));
|
||||
BOOST_CHECK(TokenTraits::isReservedKeyword(Token::Var));
|
||||
BOOST_CHECK(!TokenTraits::isReservedKeyword(Token::Illegal));
|
||||
}
|
||||
|
||||
@ -514,10 +515,11 @@ BOOST_AUTO_TEST_CASE(keyword_is_reserved)
|
||||
"switch",
|
||||
"typedef",
|
||||
"typeof",
|
||||
"unchecked"
|
||||
"unchecked",
|
||||
"var"
|
||||
};
|
||||
|
||||
BOOST_CHECK_EQUAL(std::size(keywords), static_cast<int>(Token::Unchecked) - static_cast<int>(Token::After) + 1);
|
||||
BOOST_CHECK_EQUAL(std::size(keywords), static_cast<int>(Token::Var) - static_cast<int>(Token::After) + 1);
|
||||
|
||||
for (auto const& keyword: keywords)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user