New direction

This commit is contained in:
2026-09-03 20:20:58 +00:00
parent 92451e9cdc
commit af85244587
12 changed files with 1095 additions and 998 deletions
+4 -2
View File
@@ -4,7 +4,7 @@ use crate::parse::{
Atom, AtomRef, ClosureKind, Function, Instr, JsString, JsValue, QuickJSBinary, atom_names,
};
#[derive(Debug, Clone, Copy)]
#[derive(Debug)]
pub enum CaptureFrom {
/// `parent.var_defs[i]`
ParentArg(usize),
@@ -31,7 +31,8 @@ pub struct Capture {
pub struct FlatFn {
pub name: String,
pub arg_count: usize,
pub var_count: usize, // num locals
pub var_count: usize, // num locals
pub value_names: Vec<AtomRef>, // adds names to args and locals, one for each arg, then one for each local, in one vec
pub captures: Vec<Capture>,
pub cpool: Vec<JsValue>,
pub code: Vec<Instr>,
@@ -71,6 +72,7 @@ fn walk(flat_fns: &mut Vec<FlatFn>, func: Function, atoms: &[Atom]) -> usize {
name,
arg_count: func.arg_count,
var_count: func.var_count,
value_names: func.var_defs.iter().map(|v| v.name).collect(),
captures,
cpool: Vec::new(),
code: func.byte_code,