public abstract class JSDynamicObject
extends com.oracle.truffle.api.object.DynamicObject
implements com.oracle.truffle.api.interop.TruffleObject
null
and undefined
.Modifier | Constructor and Description |
---|---|
protected |
JSDynamicObject(com.oracle.truffle.api.object.Shape shape) |
Modifier and Type | Method and Description |
---|---|
String |
defaultToString()
Follows 19.1.3.6 Object.prototype.toString(), basically: "[object " + [[Symbol.toStringTag]]
+ "]" or typically "[object Object]" (for non built-in types) if [[Symbol.toStringTag]] is
not present.
|
abstract boolean |
defineOwnProperty(Object key,
PropertyDescriptor value,
boolean doThrow)
9.1.6 [[DefineOwnProperty]] (P, Desc).
|
abstract boolean |
delete(long propIdx,
boolean isStrict) |
abstract boolean |
delete(Object key,
boolean isStrict)
9.1.10 [[Delete]] (P).
|
String |
getBuiltinToStringTag()
Returns builtinTag from step 14 of ES6+ 19.1.3.6.
|
abstract String |
getClassName()
The [[Class]] internal property.
|
static Object |
getDynamicType(com.oracle.truffle.api.object.DynamicObject obj) |
abstract Object |
getHelper(Object receiver,
long index) |
abstract Object |
getHelper(Object receiver,
Object key) |
static int |
getIntOrDefault(com.oracle.truffle.api.object.DynamicObject obj,
Object key,
int defaultValue) |
JSClass |
getJSClass() |
static JSClass |
getJSClass(com.oracle.truffle.api.object.DynamicObject obj) |
JSContext |
getJSContext() |
static JSContext |
getJSContext(com.oracle.truffle.api.object.DynamicObject obj) |
static JSSharedData |
getJSSharedData(com.oracle.truffle.api.object.DynamicObject obj) |
static Object[] |
getKeyArray(com.oracle.truffle.api.object.DynamicObject obj) |
abstract Object |
getMethodHelper(Object receiver,
Object key) |
static int |
getObjectFlags(com.oracle.truffle.api.object.DynamicObject obj) |
static Object |
getOrDefault(com.oracle.truffle.api.object.DynamicObject obj,
Object key,
Object defaultValue) |
static Object |
getOrNull(com.oracle.truffle.api.object.DynamicObject obj,
Object key) |
abstract Object |
getOwnHelper(Object receiver,
long index) |
abstract Object |
getOwnHelper(Object receiver,
Object key) |
abstract PropertyDescriptor |
getOwnProperty(Object propertyKey)
9.1.5 [[GetOwnProperty]] (P).
|
abstract List<Object> |
getOwnPropertyKeys(boolean strings,
boolean symbols)
GetOwnPropertyKeys (O, type).
|
static com.oracle.truffle.api.object.Property |
getProperty(com.oracle.truffle.api.object.DynamicObject obj,
Object key) |
static com.oracle.truffle.api.object.Property[] |
getPropertyArray(com.oracle.truffle.api.object.DynamicObject obj) |
static int |
getPropertyFlags(com.oracle.truffle.api.object.DynamicObject obj,
Object key) |
abstract JSDynamicObject |
getPrototypeOf()
9.1.1 [[GetPrototypeOf]] ().
|
Object |
getValue(long index) |
Object |
getValue(Object key)
9.1.8 [[Get]] (P, Receiver).
|
abstract boolean |
hasOnlyShapeProperties()
If true,
JSDynamicObject.ownPropertyKeys() and JSShape.getProperties(com.oracle.truffle.api.object.Shape) enumerate the same keys. |
abstract boolean |
hasOwnProperty(long index) |
abstract boolean |
hasOwnProperty(Object propName) |
static boolean |
hasProperty(com.oracle.truffle.api.object.DynamicObject obj,
Object key) |
abstract boolean |
hasProperty(long index) |
abstract boolean |
hasProperty(Object key)
9.1.7 [[HasProperty]] (P).
|
abstract boolean |
isExtensible()
9.1.3 [[IsExtensible]] ().
|
static boolean |
isJSDynamicObject(Object object)
Returns whether object is a DynamicObject of JavaScript.
|
List<Object> |
ownPropertyKeys()
9.1.12 [[OwnPropertyKeys]]().
|
abstract boolean |
preventExtensions(boolean doThrow)
9.1.4 [[PreventExtensions]] ().
|
static boolean |
removeKey(com.oracle.truffle.api.object.DynamicObject obj,
Object key) |
abstract boolean |
set(long index,
Object value,
Object receiver,
boolean isStrict) |
abstract boolean |
set(Object key,
Object value,
Object receiver,
boolean isStrict)
9.1.9 [[Set]] (P, V, Receiver).
|
boolean |
setIntegrityLevel(boolean freeze,
boolean doThrow)
ES2015 7.3.14 SetIntegrityLevel(O, level).
|
static void |
setJSClass(com.oracle.truffle.api.object.DynamicObject obj,
JSClass jsclass) |
static void |
setObjectFlags(com.oracle.truffle.api.object.DynamicObject obj,
int flags) |
static void |
setPropertyFlags(com.oracle.truffle.api.object.DynamicObject obj,
Object key,
int flags) |
abstract boolean |
setPrototypeOf(JSDynamicObject newPrototype)
9.1.2 [[SetPrototypeOf]] (V).
|
boolean |
testIntegrityLevel(boolean frozen)
ES2015 7.3.15 TestIntegrityLevel(O, level).
|
static boolean |
testProperties(com.oracle.truffle.api.object.DynamicObject obj,
Predicate<com.oracle.truffle.api.object.Property> predicate) |
abstract String |
toDisplayStringImpl(int depth,
boolean allowSideEffects)
A more informative toString variant, mainly used for error messages.
|
abstract String |
toString() |
static boolean |
updatePropertyFlags(com.oracle.truffle.api.object.DynamicObject obj,
Object key,
IntUnaryOperator updateFunction)
Update property flags, changing the object's shape if need be.
|
protected JSDynamicObject(com.oracle.truffle.api.object.Shape shape)
public final JSContext getJSContext()
public JSClass getJSClass()
public abstract JSDynamicObject getPrototypeOf()
public abstract boolean setPrototypeOf(JSDynamicObject newPrototype)
public abstract boolean isExtensible()
public abstract boolean preventExtensions(boolean doThrow)
public abstract PropertyDescriptor getOwnProperty(Object propertyKey)
public abstract boolean defineOwnProperty(Object key, PropertyDescriptor value, boolean doThrow)
public abstract boolean hasProperty(Object key)
public abstract boolean hasProperty(long index)
public abstract boolean hasOwnProperty(Object propName)
public abstract boolean hasOwnProperty(long index)
public Object getValue(Object key)
get
once DynamicObject.get(Object)
is removed.public Object getValue(long index)
public abstract boolean set(Object key, Object value, Object receiver, boolean isStrict)
public abstract boolean delete(Object key, boolean isStrict)
public abstract boolean delete(long propIdx, boolean isStrict)
public List<Object> ownPropertyKeys()
public abstract List<Object> getOwnPropertyKeys(boolean strings, boolean symbols)
public abstract boolean hasOnlyShapeProperties()
JSDynamicObject.ownPropertyKeys()
and JSShape.getProperties(com.oracle.truffle.api.object.Shape)
enumerate the same keys.public abstract String getClassName()
public String defaultToString()
For ES5, if follows 15.2.4.2 Object.prototype.toString(), basically: "[object " + [[Class]] + "]".
JSDynamicObject.getBuiltinToStringTag()
public String getBuiltinToStringTag()
JSDynamicObject.defaultToString()
public abstract String toDisplayStringImpl(int depth, boolean allowSideEffects)
depth
- allowed nesting depthpublic boolean testIntegrityLevel(boolean frozen)
public boolean setIntegrityLevel(boolean freeze, boolean doThrow)
public static boolean isJSDynamicObject(Object object)
public static JSContext getJSContext(com.oracle.truffle.api.object.DynamicObject obj)
public static JSClass getJSClass(com.oracle.truffle.api.object.DynamicObject obj)
public static void setJSClass(com.oracle.truffle.api.object.DynamicObject obj, JSClass jsclass)
public static Object getDynamicType(com.oracle.truffle.api.object.DynamicObject obj)
public static boolean hasProperty(com.oracle.truffle.api.object.DynamicObject obj, Object key)
public static com.oracle.truffle.api.object.Property getProperty(com.oracle.truffle.api.object.DynamicObject obj, Object key)
public static Object[] getKeyArray(com.oracle.truffle.api.object.DynamicObject obj)
public static com.oracle.truffle.api.object.Property[] getPropertyArray(com.oracle.truffle.api.object.DynamicObject obj)
public static Object getOrNull(com.oracle.truffle.api.object.DynamicObject obj, Object key)
public static Object getOrDefault(com.oracle.truffle.api.object.DynamicObject obj, Object key, Object defaultValue)
public static int getIntOrDefault(com.oracle.truffle.api.object.DynamicObject obj, Object key, int defaultValue)
public static int getObjectFlags(com.oracle.truffle.api.object.DynamicObject obj)
public static void setObjectFlags(com.oracle.truffle.api.object.DynamicObject obj, int flags)
public static void setPropertyFlags(com.oracle.truffle.api.object.DynamicObject obj, Object key, int flags)
public static int getPropertyFlags(com.oracle.truffle.api.object.DynamicObject obj, Object key)
public static boolean updatePropertyFlags(com.oracle.truffle.api.object.DynamicObject obj, Object key, IntUnaryOperator updateFunction)
updateFunction
- An idempotent function that returns the updated property flags based on
the previous flags.true
if successful, false
if there was no such property or no change
was made.JSDynamicObject.setPropertyFlags(DynamicObject, Object, int)
,
JSDynamicObject.getPropertyFlags(DynamicObject, Object)
public static boolean testProperties(com.oracle.truffle.api.object.DynamicObject obj, Predicate<com.oracle.truffle.api.object.Property> predicate)
public static boolean removeKey(com.oracle.truffle.api.object.DynamicObject obj, Object key)
public static JSSharedData getJSSharedData(com.oracle.truffle.api.object.DynamicObject obj)