@@ -96,6 +96,7 @@ impl ConfigurableArtifacts {
9696 storage_layout,
9797 transient_storage_layout,
9898 assembly,
99+ legacy_assembly,
99100 gas_estimates,
100101 metadata,
101102 ir,
@@ -133,6 +134,9 @@ impl ConfigurableArtifacts {
133134 if assembly || self . additional_files . assembly {
134135 selection. push ( EvmOutputSelection :: Assembly . into ( ) ) ;
135136 }
137+ if legacy_assembly || self . additional_files . legacy_assembly {
138+ selection. push ( EvmOutputSelection :: LegacyAssembly . into ( ) ) ;
139+ }
136140 if ewasm || self . additional_files . ewasm {
137141 selection. push ( EwasmOutputSelection :: All . into ( ) ) ;
138142 }
@@ -207,6 +211,7 @@ impl ArtifactOutput for ConfigurableArtifacts {
207211 let mut artifact_function_debug_data = None ;
208212 let mut artifact_method_identifiers = None ;
209213 let mut artifact_assembly = None ;
214+ let mut artifact_legacy_assembly = None ;
210215 let mut artifact_storage_layout = None ;
211216 let mut artifact_transient_storage_layout = None ;
212217 let mut generated_sources = None ;
@@ -264,7 +269,7 @@ impl ArtifactOutput for ConfigurableArtifacts {
264269 deployed_bytecode,
265270 method_identifiers,
266271 gas_estimates,
267- legacy_assembly : _ ,
272+ legacy_assembly,
268273 } = evm;
269274
270275 if self . additional_values . function_debug_data {
@@ -290,13 +295,18 @@ impl ArtifactOutput for ConfigurableArtifacts {
290295 if self . additional_values . assembly {
291296 artifact_assembly = assembly;
292297 }
298+
299+ if self . additional_values . legacy_assembly {
300+ artifact_legacy_assembly = legacy_assembly;
301+ }
293302 }
294303
295304 ConfigurableContractArtifact {
296305 abi,
297306 bytecode : artifact_bytecode,
298307 deployed_bytecode : artifact_deployed_bytecode,
299308 assembly : artifact_assembly,
309+ legacy_assembly : artifact_legacy_assembly,
300310 opcodes,
301311 function_debug_data : artifact_function_debug_data,
302312 method_identifiers : artifact_method_identifiers,
@@ -343,6 +353,7 @@ impl ArtifactOutput for ConfigurableArtifacts {
343353 ir_optimized,
344354 ewasm,
345355 assembly,
356+ legacy_assembly,
346357 source_map,
347358 generated_sources,
348359 bytecode : _,
@@ -365,6 +376,12 @@ impl ArtifactOutput for ConfigurableArtifacts {
365376 if assembly && artifact. assembly . is_none ( ) {
366377 return Ok ( true ) ;
367378 }
379+ if assembly && artifact. assembly . is_none ( ) {
380+ return Ok ( true ) ;
381+ }
382+ if legacy_assembly && artifact. legacy_assembly . is_none ( ) {
383+ return Ok ( true ) ;
384+ }
368385 if source_map && artifact. get_source_map_str ( ) . is_none ( ) {
369386 return Ok ( true ) ;
370387 }
@@ -387,6 +404,8 @@ impl ArtifactOutput for ConfigurableArtifacts {
387404 let artifact = & artifact_file. artifact ;
388405 self . additional_files . process_abi ( artifact. abi . as_ref ( ) , file) ?;
389406 self . additional_files . process_assembly ( artifact. assembly . as_deref ( ) , file) ?;
407+ self . additional_files
408+ . process_legacy_assembly ( artifact. legacy_assembly . clone ( ) , file) ?;
390409 self . additional_files
391410 . process_bytecode ( artifact. bytecode . as_ref ( ) . map ( |b| & b. object ) , file) ?;
392411 self . additional_files . process_deployed_bytecode (
@@ -424,6 +443,7 @@ pub struct ExtraOutputValues {
424443 pub storage_layout : bool ,
425444 pub transient_storage_layout : bool ,
426445 pub assembly : bool ,
446+ pub legacy_assembly : bool ,
427447 pub gas_estimates : bool ,
428448 pub metadata : bool ,
429449 pub ir : bool ,
@@ -458,6 +478,7 @@ impl ExtraOutputValues {
458478 storage_layout : true ,
459479 transient_storage_layout : true ,
460480 assembly : true ,
481+ legacy_assembly : true ,
461482 gas_estimates : true ,
462483 metadata : true ,
463484 ir : true ,
@@ -500,6 +521,7 @@ impl ExtraOutputValues {
500521 ContractOutputSelection :: Evm ( evm) => match evm {
501522 EvmOutputSelection :: All => {
502523 config. assembly = true ;
524+ config. legacy_assembly = true ;
503525 config. gas_estimates = true ;
504526 config. method_identifiers = true ;
505527 config. generated_sources = true ;
@@ -509,6 +531,9 @@ impl ExtraOutputValues {
509531 EvmOutputSelection :: Assembly => {
510532 config. assembly = true ;
511533 }
534+ EvmOutputSelection :: LegacyAssembly => {
535+ config. legacy_assembly = true ;
536+ }
512537 EvmOutputSelection :: MethodIdentifiers => {
513538 config. method_identifiers = true ;
514539 }
@@ -555,6 +580,7 @@ pub struct ExtraOutputFiles {
555580 pub ir_optimized : bool ,
556581 pub ewasm : bool ,
557582 pub assembly : bool ,
583+ pub legacy_assembly : bool ,
558584 pub source_map : bool ,
559585 pub generated_sources : bool ,
560586 pub bytecode : bool ,
@@ -582,6 +608,7 @@ impl ExtraOutputFiles {
582608 ir_optimized : true ,
583609 ewasm : true ,
584610 assembly : true ,
611+ legacy_assembly : true ,
585612 source_map : true ,
586613 generated_sources : true ,
587614 bytecode : true ,
@@ -612,6 +639,7 @@ impl ExtraOutputFiles {
612639 ContractOutputSelection :: Evm ( evm) => match evm {
613640 EvmOutputSelection :: All => {
614641 config. assembly = true ;
642+ config. legacy_assembly = true ;
615643 config. generated_sources = true ;
616644 config. source_map = true ;
617645 config. bytecode = true ;
@@ -620,6 +648,9 @@ impl ExtraOutputFiles {
620648 EvmOutputSelection :: Assembly => {
621649 config. assembly = true ;
622650 }
651+ EvmOutputSelection :: LegacyAssembly => {
652+ config. legacy_assembly = true ;
653+ }
623654 EvmOutputSelection :: ByteCode ( BytecodeOutputSelection :: GeneratedSources ) => {
624655 config. generated_sources = true ;
625656 }
@@ -713,6 +744,21 @@ impl ExtraOutputFiles {
713744 Ok ( ( ) )
714745 }
715746
747+ fn process_legacy_assembly (
748+ & self ,
749+ asm : Option < serde_json:: Value > ,
750+ file : & Path ,
751+ ) -> Result < ( ) , SolcError > {
752+ if self . legacy_assembly {
753+ if let Some ( legacy_asm) = asm {
754+ let file = file. with_extension ( "legacyAssembly" ) ;
755+ fs:: write ( & file, legacy_asm. as_str ( ) . unwrap_or_default ( ) )
756+ . map_err ( |err| SolcError :: io ( err, file) ) ?
757+ }
758+ }
759+ Ok ( ( ) )
760+ }
761+
716762 fn process_generated_sources (
717763 & self ,
718764 generated_sources : Option < & Vec < GeneratedSource > > ,
0 commit comments