@@ -298,6 +298,7 @@ void AsmAnalyzer::operator()(VariableDeclaration const& _varDecl)
298298 for (auto const & variable: _varDecl.variables )
299299 {
300300 expectValidIdentifier (variable.name , nativeLocationOf (variable));
301+ checkFutureReservedKeyword (variable.name , nativeLocationOf (variable));
301302 }
302303
303304 if (_varDecl.value )
@@ -326,6 +327,7 @@ void AsmAnalyzer::operator()(FunctionDefinition const& _funDef)
326327{
327328 yulAssert (!_funDef.name .empty ());
328329 expectValidIdentifier (_funDef.name , nativeLocationOf (_funDef));
330+ checkFutureReservedKeyword (_funDef.name , nativeLocationOf (_funDef));
329331 Block const * virtualBlock = m_info.virtualBlocks .at (&_funDef).get ();
330332 yulAssert (virtualBlock, " " );
331333 Scope& varScope = scope (virtualBlock);
@@ -951,3 +953,30 @@ void AsmAnalyzer::validateObjectStructure(langutil::SourceLocation const& _astRo
951953 }
952954 }
953955}
956+
957+ void AsmAnalyzer::checkFutureReservedKeyword (YulName _identifier, langutil::SourceLocation const & _location)
958+ {
959+ std::set<std::string> futureReservedKeywords{" leave" };
960+ if (m_evmVersion < langutil::EVMVersion::london ())
961+ futureReservedKeywords.insert (" basefee" );
962+ if (m_evmVersion < langutil::EVMVersion::paris ())
963+ futureReservedKeywords.insert (" prevrandao" );
964+ if (m_evmVersion < langutil::EVMVersion::cancun ())
965+ {
966+ futureReservedKeywords.insert (" blobbasefee" );
967+ futureReservedKeywords.insert (" blobhash" );
968+ futureReservedKeywords.insert (" mcopy" );
969+ futureReservedKeywords.insert (" tstore" );
970+ futureReservedKeywords.insert (" tload" );
971+ }
972+ if (futureReservedKeywords.count (_identifier.str ()))
973+ m_errorReporter.warning (
974+ 5470_error,
975+ _location,
976+ fmt::format (
977+ " \" {}\" will be promoted to reserved keyword in the next breaking version "
978+ " and will not be allowed anymore as an identifier." ,
979+ _identifier.str ()
980+ )
981+ );
982+ }
0 commit comments