use of com.github.anba.es6draft.runtime.types.Callable 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.Callable 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);
}
use of com.github.anba.es6draft.runtime.types.Callable in project es6draft by anba.
the class ProxyObject method get.
/**
* 9.5.8 [[Get]] (P, Receiver)
*/
@Override
public Object get(ExecutionContext cx, String propertyKey, Object receiver) {
/* step 1 (implicit) */
/* steps 2-4 */
ScriptObject handler = getProxyHandler(cx);
/* step 5 */
ScriptObject target = getProxyTarget();
/* steps 6-7 */
Callable trap = GetMethod(cx, handler, "get");
/* step 8 */
if (trap == null) {
return target.get(cx, propertyKey, receiver);
}
/* steps 9-10 */
Object trapResult = trap.call(cx, handler, target, propertyKey, receiver);
/* steps 11-12 */
Property targetDesc = target.getOwnProperty(cx, propertyKey);
/* steps 13-14 */
return validateGet(cx, trapResult, targetDesc);
}
use of com.github.anba.es6draft.runtime.types.Callable in project es6draft by anba.
the class ProxyObject method get.
/**
* 9.5.8 [[Get]] (P, Receiver)
*/
@Override
public Object get(ExecutionContext cx, Symbol propertyKey, Object receiver) {
/* step 1 (implicit) */
/* steps 2-4 */
ScriptObject handler = getProxyHandler(cx);
/* step 5 */
ScriptObject target = getProxyTarget();
/* steps 6-7 */
Callable trap = GetMethod(cx, handler, "get");
/* step 8 */
if (trap == null) {
return target.get(cx, propertyKey, receiver);
}
/* steps 9-10 */
Object trapResult = trap.call(cx, handler, target, propertyKey, receiver);
/* steps 11-12 */
Property targetDesc = target.getOwnProperty(cx, propertyKey);
/* steps 13-14 */
return validateGet(cx, trapResult, targetDesc);
}
use of com.github.anba.es6draft.runtime.types.Callable in project es6draft by anba.
the class OrdinaryObject method getValue.
/**
* 9.1.8 [[Get]] (P, Receiver)
*
* @param cx
* the execution context
* @param propertyKey
* the property key
* @param receiver
* the receiver object
* @return the property value
*/
protected Object getValue(ExecutionContext cx, long propertyKey, Object receiver) {
/* step 1 (implicit) */
/* steps 2-3 */
Property desc = getProperty(cx, propertyKey);
/* step 4 */
if (desc == null) {
ScriptObject parent = getPrototypeOf(cx);
if (parent == null) {
return UNDEFINED;
}
return parent.get(cx, propertyKey, receiver);
}
/* step 5 */
if (desc.isDataDescriptor()) {
return desc.getValue();
}
assert desc.isAccessorDescriptor();
/* step 6 */
Callable getter = desc.getGetter();
/* step 7 */
if (getter == null) {
return UNDEFINED;
}
/* step 8 */
return getter.call(cx, receiver, EMPTY_GETTER_ARGS);
}
Aggregations