@@ -5,10 +5,11 @@ use std::fs;
55use std:: path:: { Path , PathBuf } ;
66
77use crate :: types:: {
8- AssignCellRecord , AssignCompoundItemRecord , CallRecord , CellValueRecord , CompoundValueRecord , EventLogKind , FullValueRecord , FunctionId ,
9- FunctionRecord , Line , PathId , RecordEvent , ReturnRecord , StepRecord , TraceLowLevelEvent , TraceMetadata , TypeId , TypeKind , TypeRecord ,
10- TypeSpecificInfo , ValueId , ValueRecord , VariableCellRecord , VariableId ,
8+ AssignCellRecord , AssignCompoundItemRecord , AssignmentRecord , CallRecord , CellValueRecord , CompoundValueRecord , EventLogKind , FullValueRecord ,
9+ FunctionId , FunctionRecord , Line , PassBy , PathId , Place , RecordEvent , ReturnRecord , StepRecord , TraceLowLevelEvent , TraceMetadata , TypeId ,
10+ TypeKind , TypeRecord , TypeSpecificInfo , ValueRecord , VariableCellRecord , VariableId ,
1111} ;
12+ use crate :: RValue ;
1213
1314pub struct Tracer {
1415 // trace metadata:
@@ -119,7 +120,7 @@ impl Tracer {
119120
120121 pub fn register_step ( & mut self , path : & Path , line : Line ) {
121122 let path_id = self . ensure_path_id ( path) ;
122- self . events . push ( TraceLowLevelEvent :: Step ( StepRecord { path_id, line} ) ) ;
123+ self . events . push ( TraceLowLevelEvent :: Step ( StepRecord { path_id, line } ) ) ;
123124 }
124125
125126 pub fn register_call ( & mut self , function_id : FunctionId , args : Vec < FullValueRecord > ) {
@@ -182,37 +183,62 @@ impl Tracer {
182183 self . events . push ( TraceLowLevelEvent :: Value ( FullValueRecord { variable_id, value } ) ) ;
183184 }
184185
185- pub fn register_compound_value ( & mut self , value_id : ValueId , value : ValueRecord ) {
186- self . events
187- . push ( TraceLowLevelEvent :: CompoundValue ( CompoundValueRecord { value_id, value } ) ) ;
186+ pub fn register_compound_value ( & mut self , place : Place , value : ValueRecord ) {
187+ self . events . push ( TraceLowLevelEvent :: CompoundValue ( CompoundValueRecord { place, value } ) ) ;
188188 }
189189
190- pub fn register_cell_value ( & mut self , value_id : ValueId , value : ValueRecord ) {
191- self . events . push ( TraceLowLevelEvent :: CellValue ( CellValueRecord { value_id , value } ) ) ;
190+ pub fn register_cell_value ( & mut self , place : Place , value : ValueRecord ) {
191+ self . events . push ( TraceLowLevelEvent :: CellValue ( CellValueRecord { place , value } ) ) ;
192192 }
193193
194- pub fn assign_compound_item ( & mut self , value_id : ValueId , index : usize , item_value_id : ValueId ) {
194+ pub fn assign_compound_item ( & mut self , place : Place , index : usize , item_place : Place ) {
195195 self . events . push ( TraceLowLevelEvent :: AssignCompoundItem ( AssignCompoundItemRecord {
196- value_id ,
196+ place ,
197197 index,
198- item_value_id ,
198+ item_place ,
199199 } ) ) ;
200200 }
201- pub fn assign_cell ( & mut self , value_id : ValueId , new_value : ValueRecord ) {
202- self . events . push ( TraceLowLevelEvent :: AssignCell ( AssignCellRecord { value_id , new_value } ) ) ;
201+ pub fn assign_cell ( & mut self , place : Place , new_value : ValueRecord ) {
202+ self . events . push ( TraceLowLevelEvent :: AssignCell ( AssignCellRecord { place , new_value } ) ) ;
203203 }
204204
205- pub fn register_variable ( & mut self , variable_name : & str , value_id : ValueId ) {
205+ pub fn register_variable ( & mut self , variable_name : & str , place : Place ) {
206206 let variable_id = self . ensure_variable_id ( variable_name) ;
207207 self . events
208- . push ( TraceLowLevelEvent :: VariableCell ( VariableCellRecord { variable_id, value_id } ) ) ;
208+ . push ( TraceLowLevelEvent :: VariableCell ( VariableCellRecord { variable_id, place } ) ) ;
209209 }
210210
211211 pub fn drop_variable ( & mut self , variable_name : & str ) {
212212 let variable_id = self . ensure_variable_id ( variable_name) ;
213213 self . events . push ( TraceLowLevelEvent :: DropVariable ( variable_id) ) ;
214214 }
215215
216+ // history event helpers
217+ pub fn assign ( & mut self , variable_name : & str , rvalue : RValue , pass_by : PassBy ) {
218+ let variable_id = self . ensure_variable_id ( variable_name) ;
219+ self . events . push ( TraceLowLevelEvent :: Assignment ( AssignmentRecord {
220+ to : variable_id,
221+ from : rvalue,
222+ pass_by,
223+ } ) ) ;
224+ }
225+
226+ pub fn bind_variable ( & mut self , variable_name : & str , place : Place ) {
227+ unimplemented ! ( )
228+ }
229+
230+ pub fn drop_variables ( & mut self , variable_names : & [ String ] ) {
231+ unimplemented ! ( )
232+ }
233+
234+ pub fn simple_rvalue ( & mut self , variable_name : & str ) -> RValue {
235+ todo ! ( )
236+ }
237+
238+ pub fn compound_rvalue ( & mut self , variable_dependencies : & [ String ] ) -> RValue {
239+ todo ! ( )
240+ }
241+
216242 pub fn drop_last_step ( & mut self ) {
217243 self . events . push ( TraceLowLevelEvent :: DropLastStep ) ;
218244 }
0 commit comments