/// <summary> /// 15.4.4.9 /// </summary> /// <param name="target"></param> /// <param name="parameters"></param> /// <returns></returns> public JsInstance Shift(JsDictionaryObject target, JsInstance[] parameters) { if (target.Length == 0) { return(JsUndefined.Instance); } JsInstance first = target[0.ToString()]; for (int k = 1; k < target.Length; k++) { JsInstance result = null; string from = k.ToString(); string to = (k - 1).ToString(); if (target.TryGetProperty(from, out result)) { target[to] = result; } else { target.Delete(to); } } target.Delete((target.Length - 1).ToString()); if (length != int.MinValue) { length -= parameters.Length; } return(first); }
public JsInstance Shift(JsDictionaryObject target, JsInstance[] parameters) { if (target.Length == 0) { return((JsInstance)JsUndefined.Instance); } JsInstance jsInstance = target[0.ToString()]; int num; for (int index1 = 1; index1 < target.Length; ++index1) { JsInstance result = (JsInstance)null; string index2 = index1.ToString(); num = index1 - 1; string index3 = num.ToString(); if (target.TryGetProperty(index2, out result)) { target[index3] = result; } else { target.Delete(index3); } } JsDictionaryObject dictionaryObject = target; num = target.Length - 1; string index = num.ToString(); dictionaryObject.Delete(index); num = target.Length--; return(jsInstance); }