Example #1
0
        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;
        }
Example #2
0
        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;
              }
        }
Example #3
0
 public void PushFrame(String methodName, AstNode node, Frame parent)
 {
     CurrentFrame = new Frame(methodName, node, CurrentFrame, parent, CallArgs);
 }
Example #4
0
 public void PopFrame()
 {
     CurrentFrame = CurrentFrame.Caller;
 }