Java Code Examples for jdk.nashorn.internal.objects.Global#newDataDescriptor()
The following examples show how to use
jdk.nashorn.internal.objects.Global#newDataDescriptor() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ScriptObject.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * ECMA 8.10.5 ToPropertyDescriptor ( Obj ) * * @return property descriptor */ public final PropertyDescriptor toPropertyDescriptor() { final Global global = Context.getGlobal(); final PropertyDescriptor desc; if (isDataDescriptor()) { if (has(SET) || has(GET)) { throw typeError(global, "inconsistent.property.descriptor"); } desc = global.newDataDescriptor(UNDEFINED, false, false, false); } else if (isAccessorDescriptor()) { if (has(VALUE) || has(WRITABLE)) { throw typeError(global, "inconsistent.property.descriptor"); } desc = global.newAccessorDescriptor(UNDEFINED, UNDEFINED, false, false); } else { desc = global.newGenericDescriptor(false, false); } return desc.fillFrom(this); }
Example 2
Source File: ScriptObject.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * ECMA 8.10.5 ToPropertyDescriptor ( Obj ) * * @return property descriptor */ public final PropertyDescriptor toPropertyDescriptor() { final Global global = Context.getGlobal(); final PropertyDescriptor desc; if (isDataDescriptor()) { if (has(SET) || has(GET)) { throw typeError(global, "inconsistent.property.descriptor"); } desc = global.newDataDescriptor(UNDEFINED, false, false, false); } else if (isAccessorDescriptor()) { if (has(VALUE) || has(WRITABLE)) { throw typeError(global, "inconsistent.property.descriptor"); } desc = global.newAccessorDescriptor(UNDEFINED, UNDEFINED, false, false); } else { desc = global.newGenericDescriptor(false, false); } return desc.fillFrom(this); }
Example 3
Source File: ScriptObject.java From jdk8u_nashorn with GNU General Public License v2.0 | 5 votes |
/** * ECMA 8.12.1 [[GetOwnProperty]] (P) * * @param key property key * * @return Returns the Property Descriptor of the named own property of this * object, or undefined if absent. */ public Object getOwnPropertyDescriptor(final String key) { final Property property = getMap().findProperty(key); final Global global = Context.getGlobal(); if (property != null) { final ScriptFunction get = property.getGetterFunction(this); final ScriptFunction set = property.getSetterFunction(this); final boolean configurable = property.isConfigurable(); final boolean enumerable = property.isEnumerable(); final boolean writable = property.isWritable(); if (property instanceof UserAccessorProperty) { return global.newAccessorDescriptor( get != null ? get : UNDEFINED, set != null ? set : UNDEFINED, configurable, enumerable); } return global.newDataDescriptor(getWithProperty(property), configurable, enumerable, writable); } final int index = getArrayIndex(key); final ArrayData array = getArray(); if (array.has(index)) { return array.getDescriptor(global, index); } return UNDEFINED; }
Example 4
Source File: ScriptObject.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * ECMA 8.12.1 [[GetOwnProperty]] (P) * * @param key property key * * @return Returns the Property Descriptor of the named own property of this * object, or undefined if absent. */ public Object getOwnPropertyDescriptor(final String key) { final Property property = getMap().findProperty(key); final Global global = Context.getGlobal(); if (property != null) { final ScriptFunction get = property.getGetterFunction(this); final ScriptFunction set = property.getSetterFunction(this); final boolean configurable = property.isConfigurable(); final boolean enumerable = property.isEnumerable(); final boolean writable = property.isWritable(); if (property instanceof UserAccessorProperty) { return global.newAccessorDescriptor( get != null ? get : UNDEFINED, set != null ? set : UNDEFINED, configurable, enumerable); } return global.newDataDescriptor(getWithProperty(property), configurable, enumerable, writable); } final int index = getArrayIndex(key); final ArrayData array = getArray(); if (array.has(index)) { return array.getDescriptor(global, index); } return UNDEFINED; }
Example 5
Source File: ScriptObject.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * ECMA 8.12.1 [[GetOwnProperty]] (P) * * @param key property key * * @return Returns the Property Descriptor of the named own property of this * object, or undefined if absent. */ public Object getOwnPropertyDescriptor(final String key) { final Property property = getMap().findProperty(key); final Global global = Context.getGlobal(); if (property != null) { final ScriptFunction get = property.getGetterFunction(this); final ScriptFunction set = property.getSetterFunction(this); final boolean configurable = property.isConfigurable(); final boolean enumerable = property.isEnumerable(); final boolean writable = property.isWritable(); if (property instanceof UserAccessorProperty) { return global.newAccessorDescriptor( get != null ? get : UNDEFINED, set != null ? set : UNDEFINED, configurable, enumerable); } return global.newDataDescriptor(getWithProperty(property), configurable, enumerable, writable); } final int index = getArrayIndex(key); final ArrayData array = getArray(); if (array.has(index)) { return array.getDescriptor(global, index); } return UNDEFINED; }
Example 6
Source File: ScriptObject.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * ECMA 8.12.1 [[GetOwnProperty]] (P) * * @param key property key * * @return Returns the Property Descriptor of the named own property of this * object, or undefined if absent. */ public Object getOwnPropertyDescriptor(final String key) { final Property property = getMap().findProperty(key); final Global global = Context.getGlobal(); if (property != null) { final ScriptFunction get = property.getGetterFunction(this); final ScriptFunction set = property.getSetterFunction(this); final boolean configurable = property.isConfigurable(); final boolean enumerable = property.isEnumerable(); final boolean writable = property.isWritable(); if (property instanceof UserAccessorProperty) { return global.newAccessorDescriptor( get != null ? get : UNDEFINED, set != null ? set : UNDEFINED, configurable, enumerable); } return global.newDataDescriptor(getWithProperty(property), configurable, enumerable, writable); } final int index = getArrayIndex(key); final ArrayData array = getArray(); if (array.has(index)) { return array.getDescriptor(global, index); } return UNDEFINED; }
Example 7
Source File: ScriptObject.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * ECMA 8.12.1 [[GetOwnProperty]] (P) * * @param key property key * * @return Returns the Property Descriptor of the named own property of this * object, or undefined if absent. */ public Object getOwnPropertyDescriptor(final String key) { final Property property = getMap().findProperty(key); final Global global = Context.getGlobal(); if (property != null) { final ScriptFunction get = property.getGetterFunction(this); final ScriptFunction set = property.getSetterFunction(this); final boolean configurable = property.isConfigurable(); final boolean enumerable = property.isEnumerable(); final boolean writable = property.isWritable(); if (property instanceof UserAccessorProperty) { return global.newAccessorDescriptor( get != null ? get : UNDEFINED, set != null ? set : UNDEFINED, configurable, enumerable); } return global.newDataDescriptor(getWithProperty(property), configurable, enumerable, writable); } final int index = getArrayIndex(key); final ArrayData array = getArray(); if (array.has(index)) { return array.getDescriptor(global, index); } return UNDEFINED; }
Example 8
Source File: SealedArrayFilter.java From jdk8u_nashorn with GNU General Public License v2.0 | 4 votes |
@Override public PropertyDescriptor getDescriptor(final Global global, final int index) { return global.newDataDescriptor(getObject(index), false, true, true); }
Example 9
Source File: FrozenArrayFilter.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override public PropertyDescriptor getDescriptor(final Global global, final int index) { return global.newDataDescriptor(getObject(index), false, true, false); }
Example 10
Source File: SealedArrayFilter.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
@Override public PropertyDescriptor getDescriptor(final Global global, final int index) { return global.newDataDescriptor(getObject(index), false, true, true); }
Example 11
Source File: FrozenArrayFilter.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Override public PropertyDescriptor getDescriptor(final Global global, final int index) { return global.newDataDescriptor(getObject(index), false, true, false); }
Example 12
Source File: FrozenArrayFilter.java From hottub with GNU General Public License v2.0 | 4 votes |
@Override public PropertyDescriptor getDescriptor(final Global global, final int index) { return global.newDataDescriptor(getObject(index), false, true, false); }
Example 13
Source File: SealedArrayFilter.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override public PropertyDescriptor getDescriptor(final Global global, final int index) { return global.newDataDescriptor(getObject(index), false, true, true); }
Example 14
Source File: FrozenArrayFilter.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
@Override public PropertyDescriptor getDescriptor(final Global global, final int index) { return global.newDataDescriptor(getObject(index), false, true, false); }
Example 15
Source File: ArrayData.java From hottub with GNU General Public License v2.0 | 2 votes |
/** * Returns property descriptor for element at a given index * * @param global the global object * @param index the index * * @return property descriptor for element */ public PropertyDescriptor getDescriptor(final Global global, final int index) { return global.newDataDescriptor(getObject(index), true, true, true); }
Example 16
Source File: ByteBufferArrayData.java From hottub with GNU General Public License v2.0 | 2 votes |
/** * Returns property descriptor for element at a given index * * @param global the global object * @param index the index * * @return property descriptor for element */ @Override public PropertyDescriptor getDescriptor(final Global global, final int index) { // make the index properties not configurable return global.newDataDescriptor(getObject(index), false, true, true); }
Example 17
Source File: ByteBufferArrayData.java From openjdk-jdk9 with GNU General Public License v2.0 | 2 votes |
/** * Returns property descriptor for element at a given index * * @param global the global object * @param index the index * * @return property descriptor for element */ @Override public PropertyDescriptor getDescriptor(final Global global, final int index) { // make the index properties not configurable return global.newDataDescriptor(getObject(index), false, true, true); }
Example 18
Source File: ByteBufferArrayData.java From jdk8u60 with GNU General Public License v2.0 | 2 votes |
/** * Returns property descriptor for element at a given index * * @param global the global object * @param index the index * * @return property descriptor for element */ @Override public PropertyDescriptor getDescriptor(final Global global, final int index) { // make the index properties not configurable return global.newDataDescriptor(getObject(index), false, true, true); }
Example 19
Source File: ArrayData.java From TencentKona-8 with GNU General Public License v2.0 | 2 votes |
/** * Returns property descriptor for element at a given index * * @param global the global object * @param index the index * * @return property descriptor for element */ public PropertyDescriptor getDescriptor(final Global global, final int index) { return global.newDataDescriptor(getObject(index), true, true, true); }
Example 20
Source File: ByteBufferArrayData.java From TencentKona-8 with GNU General Public License v2.0 | 2 votes |
/** * Returns property descriptor for element at a given index * * @param global the global object * @param index the index * * @return property descriptor for element */ @Override public PropertyDescriptor getDescriptor(final Global global, final int index) { // make the index properties not configurable return global.newDataDescriptor(getObject(index), false, true, true); }