public ArrayIntstance(EcmaState state, EcmaValue[] values) { this.state = state; this.Prototype = state.Array; this.Class = "Array"; if (values.Length == 1 && values[0].IsNumber()) { EcmaProperty p = new EcmaProperty(); p.Value = EcmaValue.Number(values[0].ToNumber(state)); p.DontEnum = true; p.DontDelete = true; this.Property.Add("length", p); } else { EcmaProperty p = new EcmaProperty(); p.Value = EcmaValue.Number(values.Length); p.DontEnum = true; p.DontDelete = true; this.Property.Add("length", p); for (int i = 0; i < values.Length; i++) { this.Put(i.ToString(), values[i]); } } }
public virtual void Put(string P, EcmaValue V) { if (!this.CanPut(P)) { return; } if (this.Property.ContainsKey(P)) { this.Property[P].Value = V; return; } EcmaProperty prop = new EcmaProperty(); prop.Value = V; this.Property.Add(P, prop); }