示例#1
0
文件: Closure.cs 项目: TheByte/sones
        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;
        }
示例#2
0
文件: Frame.cs 项目: TheByte/sones
        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;
              }
        }
示例#3
0
 public void PushFrame(String methodName, AstNode node, Frame parent)
 {
     CurrentFrame = new Frame(methodName, node, CurrentFrame, parent, CallArgs);
 }
示例#4
0
 public void PopFrame()
 {
     CurrentFrame = CurrentFrame.Caller;
 }