/// <summary> /// https://tc39.es/ecma262/#sec-proxy-object-internal-methods-and-internal-slots-delete-p /// </summary> public override bool Delete(JsValue property) { if (!TryCallHandler(TrapDeleteProperty, new[] { _target, TypeConverter.ToPropertyKey(property) }, out var result)) { return(_target.Delete(property)); } var booleanTrapResult = TypeConverter.ToBoolean(result); if (!booleanTrapResult) { return(false); } var targetDesc = _target.GetOwnProperty(property); if (targetDesc == PropertyDescriptor.Undefined) { return(true); } if (!targetDesc.Configurable) { ExceptionHelper.ThrowTypeError(_engine.Realm, $"'deleteProperty' on proxy: trap returned truish for property '{property}' which is non-configurable in the proxy target"); } if (!_target.Extensible) { ExceptionHelper.ThrowTypeError(_engine.Realm); } return(true); }
public override bool Delete(JsValue property) { if (!TryCallHandler(TrapDeleteProperty, new JsValue[] { _target, property }, out var result)) { return(_target.Delete(property)); } var success = TypeConverter.ToBoolean(result); if (success) { var targetDesc = _target.GetOwnProperty(property); if (targetDesc != PropertyDescriptor.Undefined && !targetDesc.Configurable) { ExceptionHelper.ThrowTypeError(_engine, $"'deleteProperty' on proxy: trap returned truish for property '{property}' which is non-configurable in the proxy target"); } } return(success); }
public JsValue Pop(JsValue thisObject, JsValue[] arguments) { ObjectInstance o = TypeConverter.ToObject(Engine, thisObject); var lenVal = TypeConverter.ToNumber(o.Get("length")); uint len = TypeConverter.ToUint32(lenVal); if (len == 0) { o.Put("length", 0, true); return Undefined.Instance; } else { len = len - 1; string indx = TypeConverter.ToString(len); JsValue element = o.Get(indx); o.Delete(indx, true); o.Put("length", len, true); return element; } }
public override bool DeleteBinding(string name) { return(_bindingObject.Delete(name, false)); }
public override void DeleteAt(uint index) => _instance.Delete(TypeConverter.ToString(index), true);