public string MethodName; //either BindingInfo.Name, or name of the variable storing lambda expression #endregion Fields #region Constructors public Closure(Frame parentFrame, AstNode node, FunctionBindingInfo bindingInfo) { MethodName = bindingInfo.Name; ParentFrame = parentFrame; Node = node; BindingInfo = bindingInfo; }
public Frame Parent; //Lexical parent - not the same as the caller #endregion Fields #region Constructors public Frame(String methodName, AstNode node, Frame caller, Frame parent, object[] args) { MethodName = methodName; Node = node; Caller = caller; Parent = parent; Locals = args; //When allocating an array for parameters, we reserve extra 8 elements for locals - this should be enough in most cases // If not, we resize the array int argCount = args.Length; int localCount = node.Scope.Slots.Count; if (localCount > args.Length) { Array.Resize(ref Locals, localCount); for (int i = argCount + 1; i < localCount; i++) Locals[i] = Unassigned.Value; } }
public void PushFrame(String methodName, AstNode node, Frame parent) { CurrentFrame = new Frame(methodName, node, CurrentFrame, parent, CallArgs); }
public void PopFrame() { CurrentFrame = CurrentFrame.Caller; }