mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Disallow language keywords to be used as identifiers by NameDispenser and VarNameCleaner
Also introduce isRestrictedIdentifier helper in OptimizerUtilities
This commit is contained in:
@@ -21,15 +21,19 @@
|
||||
|
||||
#include <libyul/optimiser/OptimizerUtilities.h>
|
||||
|
||||
#include <libyul/Dialect.h>
|
||||
#include <libyul/AsmData.h>
|
||||
|
||||
#include <liblangutil/Token.h>
|
||||
#include <libsolutil/CommonData.h>
|
||||
|
||||
#include <boost/range/algorithm_ext/erase.hpp>
|
||||
|
||||
using namespace std;
|
||||
using namespace solidity;
|
||||
using namespace solidity::langutil;
|
||||
using namespace solidity::util;
|
||||
using namespace solidity::yul;
|
||||
|
||||
void yul::removeEmptyBlocks(Block& _block)
|
||||
{
|
||||
@@ -38,3 +42,8 @@ void yul::removeEmptyBlocks(Block& _block)
|
||||
};
|
||||
boost::range::remove_erase_if(_block.statements, isEmptyBlock);
|
||||
}
|
||||
|
||||
bool yul::isRestrictedIdentifier(Dialect const& _dialect, YulString const& _identifier)
|
||||
{
|
||||
return _identifier.empty() || TokenTraits::isYulKeyword(_identifier.str()) || _dialect.builtin(_identifier);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user