Example #1
0
        // helper method to support negative index into stack
        public static StackValue SetValue(this HeapElement hs, int ix, StackValue sv)
        {
            if (ix >= hs.GetAllocatedSize())
            {
                throw new System.IndexOutOfRangeException();
            }

            int        index = ix < 0 ? ix + hs.VisibleSize : ix;
            StackValue svOld = hs.Stack[index];

            hs.Stack[index] = sv;

            return(svOld);
        }