Skip to content

Commit 1747acd

Browse files
committed
feat(history events): Implement helper methods for new history events
1 parent 701d833 commit 1747acd

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

src/tracer.rs

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff 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) {

src/types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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)]

0 commit comments

Comments
 (0)