@@ -586,3 +586,43 @@ fn test_unexpected_arguments() {
586586 assert ! ( codegen_result. is_err( ) ) ;
587587 assert_eq ! ( codegen_result. unwrap_err( ) . kind, CodegenErrorKind :: InvalidArgumentCount ( String :: from( "TEST" ) , 1 , 2 ) ) ;
588588}
589+
590+ #[ test]
591+ fn test_second_opcode_parameter ( ) {
592+ let source: & str = r#"
593+ #define macro DO_NOTHING() = {
594+ }
595+
596+ #define macro ADD_OP(a, b) = {
597+ <a>
598+ <b>
599+ }
600+
601+ #define macro MAIN() = {
602+ ADD_OP(DO_NOTHING(), dup1)
603+ }
604+ "# ;
605+
606+ // Parse tokens
607+ let flattened_source = FullFileSource { source, file : None , spans : vec ! [ ] } ;
608+ let lexer = Lexer :: new ( flattened_source) ;
609+ let tokens = lexer. into_iter ( ) . map ( |x| x. unwrap ( ) ) . collect :: < Vec < Token > > ( ) ;
610+ let mut parser = Parser :: new ( tokens, None ) ;
611+
612+ // Parse the AST
613+ let mut contract = parser. parse ( ) . unwrap ( ) ;
614+
615+ // Derive storage pointers
616+ contract. derive_storage_pointers ( ) ;
617+
618+ // Instantiate Codegen
619+ let cg = Codegen :: new ( ) ;
620+
621+ // The codegen instance should have no artifact
622+ assert ! ( cg. artifact. is_none( ) ) ;
623+
624+ // Have Codegen create the runtime bytecode
625+ let r_bytes = Codegen :: generate_main_bytecode ( & EVMVersion :: default ( ) , & contract, None ) . unwrap ( ) ;
626+ // 80 = DUP1
627+ assert_eq ! ( & r_bytes, "80" ) ;
628+ }
0 commit comments