11package it .unipr .analysis .contract ;
22
3+ import it .unipr .EVMLiSA ;
34import it .unipr .cfg .EVMCFG ;
45import it .unipr .cfg .push .Push ;
56import it .unipr .frontend .EVMFrontend ;
@@ -779,9 +780,25 @@ public JSONObject toJson() {
779780 JSONObject jsonObject = new JSONObject ();
780781
781782 jsonObject .put ("address" , _address != null ? _address : new JSONArray ());
782- jsonObject .put ("bytecode" , _bytecode != null ? _bytecode : new JSONArray ());
783- jsonObject .put ("mnemonic_bytecode" , _mnemonicBytecode != null ? _mnemonicBytecode : new JSONArray ());
784- jsonObject .put ("abi" , _abi != null ? _abi : new JSONArray ());
783+ if (!EVMLiSA .isInTestMode ()) {
784+ jsonObject .put ("bytecode" , _bytecode != null ? _bytecode : new JSONArray ());
785+ jsonObject .put ("mnemonic_bytecode" , _mnemonicBytecode != null ? _mnemonicBytecode : new JSONArray ());
786+ jsonObject .put ("abi" , _abi != null ? _abi : new JSONArray ());
787+
788+ jsonObject .put ("basic_blocks" ,
789+ _basicBlocks != null ? JSONManager .basicBlocksToJson (this ) : new JSONArray ());
790+ JSONArray functionsArray = new JSONArray ();
791+ if (_functionsSignature != null && !_functionsSignature .isEmpty ())
792+ for (Signature signature : _functionsSignature )
793+ functionsArray .put (signature .toJson ());
794+ jsonObject .put ("functions_signature" , !functionsArray .isEmpty () ? functionsArray : new JSONArray ());
795+
796+ JSONArray eventsArray = new JSONArray ();
797+ if (_eventsSignature != null && !_eventsSignature .isEmpty ())
798+ for (Signature signature : _eventsSignature )
799+ eventsArray .put (signature .toJson ());
800+ jsonObject .put ("events_signature" , !eventsArray .isEmpty () ? eventsArray : new JSONArray ());
801+ }
785802
786803 jsonObject .put ("working_directory" , _workingDirectory .toString ());
787804
@@ -794,26 +811,11 @@ public JSONObject toJson() {
794811
795812 jsonObject .put ("vulnerabilities" , _vulnerabilities != null ? _vulnerabilities .toJson () : new JSONArray ());
796813
797- jsonObject .put ("basic_blocks" ,
798- _basicBlocks != null ? JSONManager .basicBlocksToJson (this ) : new JSONArray ());
799-
800814 jsonObject .put ("basic_blocks_pc" , _basicBlocks != null ? BasicBlock .basicBlocksToLongArrayToString (
801815 BasicBlock .basicBlocksToLongArray (_basicBlocks )) : new JSONArray ());
802816
803817 jsonObject .put ("execution_time" , _executionTime );
804818
805- JSONArray functionsArray = new JSONArray ();
806- if (_functionsSignature != null && !_functionsSignature .isEmpty ())
807- for (Signature signature : _functionsSignature )
808- functionsArray .put (signature .toJson ());
809- jsonObject .put ("functions_signature" , !functionsArray .isEmpty () ? functionsArray : new JSONArray ());
810-
811- JSONArray eventsArray = new JSONArray ();
812- if (_eventsSignature != null && !_eventsSignature .isEmpty ())
813- for (Signature signature : _eventsSignature )
814- eventsArray .put (signature .toJson ());
815- jsonObject .put ("events_signature" , !eventsArray .isEmpty () ? eventsArray : new JSONArray ());
816-
817819 return jsonObject ;
818820 }
819821
0 commit comments