First declosure impl

This commit is contained in:
2026-09-04 13:53:59 +00:00
parent af85244587
commit 617dbeb988
7 changed files with 376 additions and 11 deletions
+2 -4
View File
@@ -1,10 +1,8 @@
#![allow(non_snake_case)]
use std::fmt::Debug;
use crate::{
flatten::{Capture, FlatFn},
parse::{AtomRef, ImmOperand, Instr, JsValue, opcodes::OpCode},
parse::{AtomRef, ImmOperand, JsValue, opcodes::OpCode},
};
pub struct RegInstr {
@@ -51,7 +49,7 @@ impl RegFn {
fn from_flat(flat_fn: FlatFn) -> Self {
let mut stack = vec![];
let mut output = Vec::with_capacity(flat_fn.code.len());
let mut next_val = flat_fn.var_count;
let mut next_val = flat_fn.var_count; // Reserve values for locals
let mut fresh_val = || {
let v = next_val;