@@ -735,7 +735,36 @@ bool AsmAnalyzer::validateInstructions(evmasm::Instruction _instr, SourceLocatio
735
735
// The errors below are meant to be issued when processing an undeclared identifier matching a builtin name
736
736
// present on the default EVM version but not on the currently selected one,
737
737
// since the other `validateInstructions()` overload uses the default EVM version.
738
- if (_instr == evmasm::Instruction::RETURNDATACOPY && !m_evmVersion.supportsReturndata ())
738
+ if (m_eofVersion.has_value () && (
739
+ _instr == evmasm::Instruction::CALL ||
740
+ _instr == evmasm::Instruction::CALLCODE ||
741
+ _instr == evmasm::Instruction::DELEGATECALL ||
742
+ _instr == evmasm::Instruction::STATICCALL ||
743
+ _instr == evmasm::Instruction::SELFDESTRUCT ||
744
+ _instr == evmasm::Instruction::JUMP ||
745
+ _instr == evmasm::Instruction::JUMPI ||
746
+ _instr == evmasm::Instruction::PC ||
747
+ _instr == evmasm::Instruction::CREATE ||
748
+ _instr == evmasm::Instruction::CREATE2 ||
749
+ _instr == evmasm::Instruction::CODESIZE ||
750
+ _instr == evmasm::Instruction::CODECOPY ||
751
+ _instr == evmasm::Instruction::EXTCODESIZE ||
752
+ _instr == evmasm::Instruction::EXTCODECOPY ||
753
+ _instr == evmasm::Instruction::EXTCODEHASH ||
754
+ _instr == evmasm::Instruction::GAS
755
+ ))
756
+ {
757
+ m_errorReporter.typeError (
758
+ 9132_error,
759
+ _location,
760
+ fmt::format (
761
+ " The \" {instruction}\" instruction is {kind} VMs (you are currently compiling to EOF)." ,
762
+ fmt::arg (" instruction" , boost::to_lower_copy (instructionInfo (_instr, m_evmVersion).name )),
763
+ fmt::arg (" kind" , " only available in legacy bytecode" )
764
+ )
765
+ );
766
+ }
767
+ else if (_instr == evmasm::Instruction::RETURNDATACOPY && !m_evmVersion.supportsReturndata ())
739
768
errorForVM (7756_error, " only available for Byzantium-compatible" );
740
769
else if (_instr == evmasm::Instruction::RETURNDATASIZE && !m_evmVersion.supportsReturndata ())
741
770
errorForVM (4778_error, " only available for Byzantium-compatible" );
@@ -788,35 +817,6 @@ bool AsmAnalyzer::validateInstructions(evmasm::Instruction _instr, SourceLocatio
788
817
)
789
818
);
790
819
}
791
- else if (m_eofVersion.has_value () && (
792
- _instr == evmasm::Instruction::CALL ||
793
- _instr == evmasm::Instruction::CALLCODE ||
794
- _instr == evmasm::Instruction::DELEGATECALL ||
795
- _instr == evmasm::Instruction::STATICCALL ||
796
- _instr == evmasm::Instruction::SELFDESTRUCT ||
797
- _instr == evmasm::Instruction::JUMP ||
798
- _instr == evmasm::Instruction::JUMPI ||
799
- _instr == evmasm::Instruction::PC ||
800
- _instr == evmasm::Instruction::CREATE ||
801
- _instr == evmasm::Instruction::CREATE2 ||
802
- _instr == evmasm::Instruction::CODESIZE ||
803
- _instr == evmasm::Instruction::CODECOPY ||
804
- _instr == evmasm::Instruction::EXTCODESIZE ||
805
- _instr == evmasm::Instruction::EXTCODECOPY ||
806
- _instr == evmasm::Instruction::EXTCODEHASH ||
807
- _instr == evmasm::Instruction::GAS
808
- ))
809
- {
810
- m_errorReporter.typeError (
811
- 9132_error,
812
- _location,
813
- fmt::format (
814
- " The \" {instruction}\" instruction is {kind} VMs (you are currently compiling to EOF)." ,
815
- fmt::arg (" instruction" , boost::to_lower_copy (instructionInfo (_instr, m_evmVersion).name )),
816
- fmt::arg (" kind" , " only available in legacy bytecode" )
817
- )
818
- );
819
- }
820
820
else
821
821
{
822
822
// Sanity check
0 commit comments