use of com.github.anba.es6draft.runtime.types.builtins.OrdinaryObject.IsCompatiblePropertyDescriptor in project es6draft by anba.
the class ProxyObject method validateGetOwnProperty.
private Property validateGetOwnProperty(ExecutionContext cx, ScriptObject target, Object trapResultObj, Property targetDesc) {
/* step 14 */
if (Type.isUndefined(trapResultObj)) {
if (targetDesc == null) {
return null;
}
if (!targetDesc.isConfigurable()) {
throw newTypeError(cx, Messages.Key.ProxyNotConfigurable);
}
boolean extensibleTarget = IsExtensible(cx, target);
if (!extensibleTarget) {
throw newTypeError(cx, Messages.Key.ProxyNotExtensible);
}
return null;
}
if (targetDesc != null) {
// need copy because of possible side-effects in IsExtensible()
targetDesc = targetDesc.clone();
}
/* steps 15-16 */
boolean extensibleTarget = IsExtensible(cx, target);
/* steps 17-18 */
PropertyDescriptor resultDesc = ToPropertyDescriptor(cx, trapResultObj);
/* step 19 */
CompletePropertyDescriptor(resultDesc);
/* step 20 */
boolean valid = IsCompatiblePropertyDescriptor(extensibleTarget, resultDesc, targetDesc);
/* step 21 */
if (!valid) {
throw newTypeError(cx, Messages.Key.ProxyIncompatibleDescriptor);
}
/* step 22 */
if (!resultDesc.isConfigurable()) {
if (targetDesc == null || targetDesc.isConfigurable()) {
throw newTypeError(cx, Messages.Key.ProxyAbsentOrConfigurable);
}
}
/* step 23 */
return resultDesc.toProperty();
}
Aggregations