protected override PromiseState GetState(out EcmaValue value) { if (this.Count == 0 || this.All(v => v.State != PromiseState.Pending)) { RuntimeObject objectProto = RuntimeRealm.Current.GetRuntimeObject(WellKnownObject.ObjectPrototype); List <EcmaValue> values = new List <EcmaValue>(); foreach (PromiseAggregateHandler handler in this) { RuntimeObject obj = RuntimeObject.Create(objectProto); if (handler.State == PromiseState.Fulfilled) { obj.CreateDataPropertyOrThrow(WellKnownProperty.Status, "fulfilled"); obj.CreateDataPropertyOrThrow(WellKnownProperty.Value, handler.Value); } else { obj.CreateDataPropertyOrThrow(WellKnownProperty.Status, "rejected"); obj.CreateDataPropertyOrThrow(WellKnownProperty.Reason, handler.Value); } values.Add(obj); } value = new EcmaArray(values); return(PromiseState.Fulfilled); } return(base.GetState(out value)); }
public IntlProviderOptions(EcmaValue value) { this.readOnly = true; this.options = value == default ? RuntimeObject.Create(null) : value.ToObject(); }