File tree 1 file changed +14
-1
lines changed 1 file changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,9 @@ let call_function = 0x64;
11
11
* Primitive instruction type, which can be encoded and decoded.
12
12
*/
13
13
use std:: collections:: HashMap ;
14
+ use std:: fmt;
14
15
15
- #[ derive( Debug , Clone ) ]
16
+ #[ derive( Clone ) ]
16
17
pub struct CodeObject {
17
18
pub instructions : Vec < Instruction > ,
18
19
pub label_map : HashMap < Label , usize > ,
@@ -117,3 +118,15 @@ pub enum BlockType {
117
118
Except,
118
119
}
119
120
*/
121
+
122
+ impl fmt:: Debug for CodeObject {
123
+ fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
124
+ let inst_str = self . instructions . iter ( )
125
+ . enumerate ( )
126
+ . map ( |( i, inst) | format ! ( "Inst {}: {:?}" , i, inst) )
127
+ . collect :: < Vec < _ > > ( )
128
+ . join ( "\n " ) ;
129
+ let labelmap_str = format ! ( "label_map: {:?}" , self . label_map) ;
130
+ write ! ( f, "Code Object {{ \n {}\n {} }}" , inst_str, labelmap_str)
131
+ }
132
+ }
You can’t perform that action at this time.
0 commit comments