@@ -52,10 +52,10 @@ pub fn transform_code_str(
5252 let t = & mut Transformer {
5353 allocator : & allocator,
5454 file_instructions : & file_instructions,
55- current_function_identifier : None ,
56- modify_return_value : false ,
55+ // current_function_identifier: None,
56+ // modify_return_value: false,
5757 module_name,
58- sub_function_counter : 0 ,
58+ // sub_function_counter: 0,
5959 } ;
6060
6161 traverse_mut ( t, & allocator, program, symbols, scopes) ;
@@ -90,9 +90,9 @@ pub fn transform_code_str(
9090struct Transformer < ' a > {
9191 allocator : & ' a Allocator ,
9292 file_instructions : & ' a FileInstructions ,
93- current_function_identifier : Option < String > , // Only set if we want to instrument the current function
94- sub_function_counter : i32 , // Counter to keep track of how many sub functions we are in
95- modify_return_value : bool ,
93+ // current_function_identifier: Option<String>, // Only set if we want to instrument the current function
94+ // sub_function_counter: i32, // Counter to keep track of how many sub functions we are in
95+ // modify_return_value: bool,
9696 module_name : & ' a str ,
9797}
9898
@@ -117,23 +117,23 @@ impl<'a> Traverse<'a> for Transformer<'a> {
117117 . find ( |f| f. node_type == "MethodDefinition" && f. name == method_name) ;
118118
119119 if found_instruction. is_none ( ) {
120- self . current_function_identifier = None ;
121- self . modify_return_value = false ;
120+ // self.current_function_identifier = None;
121+ // self.modify_return_value = false;
122122 return ;
123123 }
124124
125125 let instruction = found_instruction. unwrap ( ) ;
126126
127- let function_identifier = format ! ( "{}.{}" , self . module_name, method_name) ;
127+ /* let function_identifier = format!("{}.{}", self.module_name, method_name);
128128 self.current_function_identifier = Some(function_identifier.clone());
129- self . modify_return_value = instruction. modify_return_value ;
129+ self.modify_return_value = instruction.modify_return_value;*/
130130
131131 let body = node. value . body . as_mut ( ) . unwrap ( ) ;
132132
133133 if instruction. inspect_args {
134134 let source_text: & ' a str = self . allocator . alloc_str ( & format ! (
135135 "__instrumentInspectArgs('{}', false, arguments);" ,
136- self . current_function_identifier . as_ref ( ) . unwrap ( )
136+ instruction . identifier
137137 ) ) ;
138138
139139 body. statements . insert (
@@ -146,7 +146,7 @@ impl<'a> Traverse<'a> for Transformer<'a> {
146146 }
147147 }
148148
149- fn exit_method_definition (
149+ /* fn exit_method_definition(
150150 &mut self,
151151 _node: &mut MethodDefinition<'a>,
152152 ctx: &mut TraverseCtx<'a>,
@@ -183,5 +183,5 @@ impl<'a> Traverse<'a> for Transformer<'a> {
183183
184184 // Todo support modifying return value
185185 //AstBuilder::new(self.allocator).return_statement(node.span, argument)
186- }
186+ }*/
187187}
0 commit comments