File tree Expand file tree Collapse file tree 3 files changed +24
-7
lines changed Expand file tree Collapse file tree 3 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -114,7 +114,7 @@ mod tests {
114114
115115 tracer. drop_variables ( & [ "variable1" . to_string ( ) , "variable2" . to_string ( ) , "variable3" . to_string ( ) ] ) ;
116116
117- assert_eq ! ( tracer. events. len( ) , 34 ) ;
117+ assert_eq ! ( tracer. events. len( ) , 46 ) ;
118118 // visible with
119119 // cargo tets -- --nocapture
120120 // println!("{:#?}", tracer.events);
Original file line number Diff line number Diff line change @@ -224,19 +224,36 @@ impl Tracer {
224224 }
225225
226226 pub fn bind_variable ( & mut self , variable_name : & str , place : Place ) {
227- unimplemented ! ( )
227+ let variable_id = self . ensure_variable_id ( variable_name) ;
228+ self . events . push ( TraceLowLevelEvent :: BindVariable ( crate :: BindVariableRecord {
229+ variable_id,
230+ place,
231+ } ) ) ;
228232 }
229233
230234 pub fn drop_variables ( & mut self , variable_names : & [ String ] ) {
231- unimplemented ! ( )
235+ let variable_ids : Vec < VariableId > = variable_names
236+ . to_vec ( )
237+ . iter ( )
238+ . map ( | variable_name | self . ensure_variable_id ( variable_name) )
239+ . collect ( ) ;
240+ self . events . push ( TraceLowLevelEvent :: DropVariables (
241+ variable_ids
242+ ) )
232243 }
233244
234245 pub fn simple_rvalue ( & mut self , variable_name : & str ) -> RValue {
235- todo ! ( )
246+ let variable_id = self . ensure_variable_id ( variable_name) ;
247+ RValue :: Simple ( variable_id)
236248 }
237-
249+
238250 pub fn compound_rvalue ( & mut self , variable_dependencies : & [ String ] ) -> RValue {
239- todo ! ( )
251+ let variable_ids : Vec < VariableId > = variable_dependencies
252+ . to_vec ( )
253+ . iter ( )
254+ . map ( | variable_dependency | self . ensure_variable_id ( variable_dependency) )
255+ . collect ( ) ;
256+ RValue :: Compound ( variable_ids)
240257 }
241258
242259 pub fn drop_last_step ( & mut self ) {
Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ pub enum RValue {
7777 Simple ( VariableId ) ,
7878 // eventually in future:
7979 // discuss more: Const(String, ValueRecord),
80- Compound ( Vec < RValue > ) ,
80+ Compound ( Vec < VariableId > ) ,
8181}
8282
8383#[ derive( Debug , Clone , Serialize , Deserialize ) ]
You can’t perform that action at this time.
0 commit comments