use of com.github.anba.es6draft.runtime.types.Property in project es6draft by anba.
the class ArgumentsObject method getProperty.
/**
* 9.4.4.1 [[GetOwnProperty]] (P)
*/
@Override
protected Property getProperty(ExecutionContext cx, long propertyKey) {
/* step 1 (not applicable) */
/* step 2 */
Property desc = ordinaryGetOwnProperty(propertyKey);
/* step 3 */
if (desc == null) {
return desc;
}
/* step 4 */
ParameterMap map = this.parameterMap;
/* steps 5-6 */
boolean isMapped = map != null && map.hasOwnProperty(propertyKey);
/* step 7 */
if (isMapped) {
// FIXME: spec issue - maybe add assertion: IsDataDescriptor(desc)?
assert desc.isDataDescriptor();
PropertyDescriptor d = desc.toPropertyDescriptor();
d.setValue(map.get(propertyKey));
desc = d.toProperty();
}
/* step 9 */
return desc;
}
use of com.github.anba.es6draft.runtime.types.Property in project es6draft by anba.
the class ProxyObject method defineOwnProperty.
/**
* 9.5.6 [[DefineOwnProperty]] (P, Desc)
*/
@Override
public boolean defineOwnProperty(ExecutionContext cx, Symbol propertyKey, PropertyDescriptor desc) {
/* step 1 (implicit) */
/* steps 2-4 */
ScriptObject handler = getProxyHandler(cx);
/* step 5 */
ScriptObject target = getProxyTarget();
/* steps 6-7 */
Callable trap = GetMethod(cx, handler, "defineProperty");
/* step 8 */
if (trap == null) {
return target.defineOwnProperty(cx, propertyKey, desc);
}
/* step 9 */
Object descObj = FromPropertyDescriptor(cx, desc);
/* steps 10-11 */
boolean trapResult = ToBoolean(trap.call(cx, handler, target, propertyKey, descObj));
/* step 12 */
if (!trapResult) {
return false;
}
/* steps 13-14 */
Property targetDesc = target.getOwnProperty(cx, propertyKey);
/* steps 15-21 */
return validateDefineOwnProperty(cx, desc, target, targetDesc);
}
use of com.github.anba.es6draft.runtime.types.Property in project es6draft by anba.
the class ProxyObject method getOwnProperty.
/**
* 9.5.5 [[GetOwnProperty]] (P)
*/
@Override
public Property getOwnProperty(ExecutionContext cx, Symbol propertyKey) {
/* step 1 (implicit) */
/* steps 2-4 */
ScriptObject handler = getProxyHandler(cx);
/* step 5 */
ScriptObject target = getProxyTarget();
/* steps 6-7 */
Callable trap = GetMethod(cx, handler, "getOwnPropertyDescriptor");
/* step 8 */
if (trap == null) {
return target.getOwnProperty(cx, propertyKey);
}
/* steps 9-10 */
Object trapResultObj = trap.call(cx, handler, target, propertyKey);
/* step 11 */
if (!(Type.isObject(trapResultObj) || Type.isUndefined(trapResultObj))) {
throw newTypeError(cx, Messages.Key.ProxyNotObjectOrUndefined);
}
/* steps 12-13 */
Property targetDesc = target.getOwnProperty(cx, propertyKey);
/* steps 14-23 */
return validateGetOwnProperty(cx, target, trapResultObj, targetDesc);
}
use of com.github.anba.es6draft.runtime.types.Property in project es6draft by anba.
the class ProxyObject method hasProperty.
/**
* 9.5.7 [[HasProperty]] (P)
*/
@Override
public boolean hasProperty(ExecutionContext cx, Symbol propertyKey) {
/* step 1 (implicit) */
/* steps 2-4 */
ScriptObject handler = getProxyHandler(cx);
/* step 5 */
ScriptObject target = getProxyTarget();
/* steps 6-7 */
Callable trap = GetMethod(cx, handler, "has");
/* step 8 */
if (trap == null) {
return target.hasProperty(cx, propertyKey);
}
/* steps 9-10 */
boolean booleanTrapResult = ToBoolean(trap.call(cx, handler, target, propertyKey));
/* step 11 */
if (!booleanTrapResult) {
/* steps 11.a-11.b */
Property targetDesc = target.getOwnProperty(cx, propertyKey);
/* step 11.c */
validateHasProperty(cx, target, targetDesc);
}
/* step 12 */
return booleanTrapResult;
}
use of com.github.anba.es6draft.runtime.types.Property in project es6draft by anba.
the class ProxyObject method delete.
/**
* 9.5.10 [[Delete]] (P)
*/
@Override
public boolean delete(ExecutionContext cx, String propertyKey) {
/* step 1 (implicit) */
/* steps 2-4 */
ScriptObject handler = getProxyHandler(cx);
/* step 5 */
ScriptObject target = getProxyTarget();
/* steps 6-7 */
Callable trap = GetMethod(cx, handler, "deleteProperty");
/* step 8 */
if (trap == null) {
return target.delete(cx, propertyKey);
}
/* steps 9-10 */
boolean trapResult = ToBoolean(trap.call(cx, handler, target, propertyKey));
/* step 11 */
if (!trapResult) {
return false;
}
/* steps 12-13 */
Property targetDesc = target.getOwnProperty(cx, propertyKey);
/* steps 14-16 */
return validateDelete(cx, targetDesc);
}
Aggregations