Add object-oriented records example

This commit is contained in:
Michael Schimmel
2026-02-26 21:54:26 +01:00
parent bf74795e01
commit 512193febc
4 changed files with 96 additions and 4 deletions
+4 -1
View File
@@ -472,9 +472,12 @@ impl Optimizer {
for (old_idx, capture_addr) in original_upvalues.iter().enumerate() {
let mut inlined_val = None;
if let Some(val) = sub.get_value(capture_addr) {
if !sub.assigned.contains(capture_addr)
&& let Some(val) = sub.get_value(capture_addr)
{
inlined_val = Some(val.clone());
}
if let Address::Local(slot) = capture_addr {
sub.captured_slots.insert(*slot);
}
+1 -3
View File
@@ -159,9 +159,7 @@ impl UsageInfo {
pub fn collect_pattern(&mut self, node: &AnalyzedNode) {
match &node.kind {
BoundKind::Define { addr, .. } => {
self.assigned.insert(*addr);
}
BoundKind::Define { .. } => {}
BoundKind::Set { addr, .. } => {
self.assigned.insert(*addr);
}