@@ -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);
@@ -953,3 +955,30 @@ void AsmAnalyzer::validateObjectStructure(langutil::SourceLocation const& _astRo
953955 }
954956 }
955957}
958+
959+ void AsmAnalyzer::checkFutureReservedKeyword (YulName _identifier, langutil::SourceLocation const & _location)
960+ {
961+ std::set<std::string> futureReservedKeywords{" leave" };
962+ if (m_evmVersion < langutil::EVMVersion::london ())
963+ futureReservedKeywords.insert (" basefee" );
964+ if (m_evmVersion < langutil::EVMVersion::paris ())
965+ futureReservedKeywords.insert (" prevrandao" );
966+ if (m_evmVersion < langutil::EVMVersion::cancun ())
967+ {
968+ futureReservedKeywords.insert (" blobbasefee" );
969+ futureReservedKeywords.insert (" blobhash" );
970+ futureReservedKeywords.insert (" mcopy" );
971+ futureReservedKeywords.insert (" tstore" );
972+ futureReservedKeywords.insert (" tload" );
973+ }
974+ if (futureReservedKeywords.count (_identifier.str ()))
975+ m_errorReporter.warning (
976+ 5470_error,
977+ _location,
978+ fmt::format (
979+ " \" {}\" will be promoted to reserved keyword in the next breaking version "
980+ " and will not be allowed anymore as an identifier." ,
981+ _identifier.str ()
982+ )
983+ );
984+ }
0 commit comments