private static ArrayInstance InitReturnValueArray(ArrayInstance array, string inputValue, int lengthValue, int indexValue) { array.SetOwnProperty("index", new PropertyDescriptor(indexValue, PropertyFlag.ConfigurableEnumerableWritable)); array.SetOwnProperty("input", new PropertyDescriptor(inputValue, PropertyFlag.ConfigurableEnumerableWritable)); array.SetOwnProperty("length", new PropertyDescriptor(lengthValue, PropertyFlag.OnlyWritable)); return(array); }
private static JsValue Convert(Engine e, object v) { var array = (System.Array)v; var arrayLength = (uint)array.Length; var jsArray = new ArrayInstance(e, arrayLength); jsArray.Prototype = e.Array.PrototypeObject; jsArray.Extensible = true; for (uint i = 0; i < arrayLength; ++i) { var jsItem = FromObject(e, array.GetValue(i)); jsArray.WriteArrayValue(i, new PropertyDescriptor(jsItem, PropertyFlag.ConfigurableEnumerableWritable)); } jsArray.SetOwnProperty("length", new PropertyDescriptor(arrayLength, PropertyFlag.OnlyWritable)); return(jsArray); }