So, remove field level from ArkStackRef and produce captures directly. Also, it's unnecessary to compute the values of free variables, we should just record their names, i.e. Frame.captures.
ArkFn needs to get its captures as an array of ArkExp supplied by calling symRef on the names of the captures. That removes the for loop from symRef. The caller of ArkFn also needs to compile code to evaluate the captures (i.e. pass the names to symRef), and pass those exps to the constructor of ArkFn.
So, remove field
level
fromArkStackRef
and produce captures directly. Also, it's unnecessary to compute the values of free variables, we should just record their names, i.e.Frame.captures
.ArkFn
needs to get its captures as an array ofArkExp
supplied by callingsymRef
on the names of the captures. That removes thefor
loop fromsymRef
. The caller ofArkFn
also needs to compile code to evaluate the captures (i.e. pass the names tosymRef
), and pass those exps to the constructor ofArkFn
.