use of com.github.anba.es6draft.runtime.types.Property in project es6draft by anba.
the class OrdinaryObject method ordinaryGet.
/**
* 9.1.8.1 OrdinaryGet (O, P, Receiver)
*
* @param cx
* the execution context
* @param propertyKey
* the property key
* @param receiver
* the receiver object
* @return the property value
*/
protected final Object ordinaryGet(ExecutionContext cx, long propertyKey, Object receiver) {
/* step 1 (implicit) */
/* step 2 */
Property desc = getOwnProperty(cx, propertyKey);
/* step 3 */
if (desc == null) {
ScriptObject parent = getPrototypeOf(cx);
if (parent == null) {
return UNDEFINED;
}
return parent.get(cx, propertyKey, receiver);
}
/* step 4 */
if (desc.isDataDescriptor()) {
return desc.getValue();
}
/* step 5 */
assert desc.isAccessorDescriptor();
/* step 6 */
Callable getter = desc.getGetter();
/* step 7 */
if (getter == null) {
return UNDEFINED;
}
/* step 8 */
return getter.call(cx, receiver, EMPTY_ARRAY);
}
use of com.github.anba.es6draft.runtime.types.Property in project es6draft by anba.
the class OrdinaryObject method ordinaryGet.
/**
* 9.1.8.1 OrdinaryGet (O, P, Receiver)
*
* @param cx
* the execution context
* @param propertyKey
* the property key
* @param receiver
* the receiver object
* @return the property value
*/
protected final Object ordinaryGet(ExecutionContext cx, String propertyKey, Object receiver) {
/* step 1 (implicit) */
/* step 2 */
Property desc = getOwnProperty(cx, propertyKey);
/* step 3 */
if (desc == null) {
ScriptObject parent = getPrototypeOf(cx);
if (parent == null) {
return UNDEFINED;
}
return parent.get(cx, propertyKey, receiver);
}
/* step 4 */
if (desc.isDataDescriptor()) {
return desc.getValue();
}
/* step 5 */
assert desc.isAccessorDescriptor();
/* step 6 */
Callable getter = desc.getGetter();
/* step 7 */
if (getter == null) {
return UNDEFINED;
}
/* step 8 */
return getter.call(cx, receiver, EMPTY_ARRAY);
}
use of com.github.anba.es6draft.runtime.types.Property in project es6draft by anba.
the class OrdinaryObject method isEnumerableOwnProperty.
/**
* Subclasses can override this method if they have virtual properties.
*
* @param cx
* the execution context
* @param propertyKey
* the property key
* @return the property enumerable status
*/
@Override
public Enumerability isEnumerableOwnProperty(ExecutionContext cx, String propertyKey) {
Property prop;
long index = IndexedMap.toIndex(propertyKey);
if (IndexedMap.isIndex(index)) {
prop = getOwnProperty(cx, index);
} else {
prop = getOwnProperty(cx, propertyKey);
}
if (prop == null) {
return Enumerability.Deleted;
}
return Enumerability.isEnumerable(prop.isEnumerable());
}
use of com.github.anba.es6draft.runtime.types.Property in project es6draft by anba.
the class OrdinaryObject method ordinaryDefineOwnProperty.
/**
* 9.1.6.1 OrdinaryDefineOwnProperty (O, P, Desc)
*
* @param cx
* the execution context
* @param propertyKey
* the property key
* @param desc
* the property descriptor
* @return {@code true} on success
*/
protected final boolean ordinaryDefineOwnProperty(ExecutionContext cx, String propertyKey, PropertyDescriptor desc) {
assert !IndexedMap.isIndex(propertyKey);
/* step 1 */
Property current = getOwnProperty(cx, propertyKey);
/* step 2 */
boolean extensible = isExtensible();
/* step 3 */
return validateAndApplyPropertyDescriptor(properties, propertyKey, extensible, desc, current);
}
use of com.github.anba.es6draft.runtime.types.Property in project es6draft by anba.
the class ModuleNamespaceObject method ModuleNamespaceCreate.
/**
* 9.4.6.11 ModuleNamespaceCreate (module, exports)
*
* @param cx
* the execution context
* @param module
* the module record
* @param exports
* the exported bindings
* @return the new module namespace object
*/
public static ModuleNamespaceObject ModuleNamespaceCreate(ExecutionContext cx, ModuleRecord module, Set<String> exports) {
/* step 2 */
assert module.getNamespace() == null;
/* step 3 (not applicable) */
/* steps 4-8 */
ModuleNamespaceObject m = new ModuleNamespaceObject(cx.getRealm(), module, exports);
/* step 9 */
// 26.3.1 @@toStringTag
m.infallibleDefineOwnProperty(BuiltinSymbol.toStringTag.get(), new Property("Module", false, false, false));
// TODO: spec issue - add [[Extensible]] and set to false.
m.setExtensible(false);
/* step 10 */
module.setNamespace(m);
/* step 11 */
return m;
}
Aggregations