예제 #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;
 }