本文整理汇总了C++中PropDesc::isUndefined方法的典型用法代码示例。如果您正苦于以下问题:C++ PropDesc::isUndefined方法的具体用法?C++ PropDesc::isUndefined怎么用?C++ PropDesc::isUndefined使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropDesc
的用法示例。
在下文中一共展示了PropDesc::isUndefined方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: current
bool
js::HasElement(JSContext *cx, Handle<ObjectImpl*> obj, uint32_t index, unsigned resolveFlags,
bool *found)
{
NEW_OBJECT_REPRESENTATION_ONLY();
Rooted<ObjectImpl*> current(cx, obj);
do {
MOZ_ASSERT(current);
if (Downcast(current)->is<ProxyObject>())
MOZ_ASSUME_UNREACHABLE("NYI: proxy [[HasProperty]]");
PropDesc prop;
if (!GetOwnElement(cx, current, index, resolveFlags, &prop))
return false;
if (!prop.isUndefined()) {
*found = true;
return true;
}
current = current->getProto();
if (current)
continue;
*found = false;
return true;
} while (false);
MOZ_ASSUME_UNREACHABLE("buggy control flow");
}
示例2: while
bool
js::HasElement(JSContext *cx, ObjectImpl *obj, uint32_t index, bool *found)
{
NEW_OBJECT_REPRESENTATION_ONLY();
do {
MOZ_ASSERT(obj);
if (static_cast<JSObject *>(obj)->isProxy()) { // XXX
MOZ_NOT_REACHED("NYI: proxy [[HasProperty]]");
return false;
}
PropDesc prop;
if (!GetOwnElement(cx, obj, index, &prop))
return false;
if (!prop.isUndefined()) {
*found = true;
return true;
}
obj = obj->getProto();
if (obj)
continue;
*found = false;
return true;
} while (false);
MOZ_NOT_REACHED("buggy control flow");
return false;
}
示例3: setter
bool
js::SetElement(JSContext *cx, Handle<ObjectImpl*> obj, Handle<ObjectImpl*> receiver,
uint32_t index, const Value &v, unsigned resolveFlags, bool *succeeded)
{
NEW_OBJECT_REPRESENTATION_ONLY();
Rooted<ObjectImpl*> current(cx, obj);
RootedValue setter(cx);
MOZ_ASSERT(receiver);
do {
MOZ_ASSERT(current);
if (Downcast(current)->isProxy()) {
MOZ_NOT_REACHED("NYI: proxy [[SetP]]");
return false;
}
PropDesc ownDesc;
if (!GetOwnElement(cx, current, index, resolveFlags, &ownDesc))
return false;
if (!ownDesc.isUndefined()) {
if (ownDesc.isDataDescriptor()) {
if (!ownDesc.writable()) {
*succeeded = false;
return true;
}
if (receiver == current) {
PropDesc updateDesc = PropDesc::valueOnly(v);
return DefineElement(cx, receiver, index, updateDesc, false, resolveFlags,
succeeded);
}
PropDesc newDesc;
return DefineElement(cx, receiver, index, newDesc, false, resolveFlags, succeeded);
}
if (ownDesc.isAccessorDescriptor()) {
setter = ownDesc.setterValue();
if (setter.isUndefined()) {
*succeeded = false;
return true;
}
InvokeArgsGuard args;
if (!cx->stack.pushInvokeArgs(cx, 1, &args))
return false;
/* Push set, receiver, and v as the sole argument. */
args.setCallee(setter);
args.setThis(ObjectValue(*current));
args[0] = v;
*succeeded = true;
return Invoke(cx, args);
}
MOZ_NOT_REACHED("NYI: setting PropertyOp-based property");
return false;
}
current = current->getProto();
if (current)
continue;
PropDesc newDesc(v, PropDesc::Writable, PropDesc::Enumerable, PropDesc::Configurable);
return DefineElement(cx, receiver, index, newDesc, false, resolveFlags, succeeded);
} while (false);
MOZ_NOT_REACHED("buggy control flow");
return false;
}
示例4: getter
bool
js::GetElement(JSContext *cx, Handle<ObjectImpl*> obj, Handle<ObjectImpl*> receiver, uint32_t index,
unsigned resolveFlags, Value *vp)
{
NEW_OBJECT_REPRESENTATION_ONLY();
Rooted<ObjectImpl*> current(cx, obj);
RootedValue getter(cx);
do {
MOZ_ASSERT(current);
if (Downcast(current)->isProxy()) {
MOZ_NOT_REACHED("NYI: proxy [[GetP]]");
return false;
}
PropDesc desc;
if (!GetOwnElement(cx, current, index, resolveFlags, &desc))
return false;
/* No property? Recur or bottom out. */
if (desc.isUndefined()) {
current = current->getProto();
if (current)
continue;
vp->setUndefined();
return true;
}
/* If it's a data property, return the value. */
if (desc.isDataDescriptor()) {
*vp = desc.value();
return true;
}
/* If it's an accessor property, call its [[Get]] with the receiver. */
if (desc.isAccessorDescriptor()) {
getter = desc.getterValue();
if (getter.isUndefined()) {
vp->setUndefined();
return true;
}
InvokeArgsGuard args;
if (!cx->stack.pushInvokeArgs(cx, 0, &args))
return false;
/* Push getter, receiver, and no args. */
args.setCallee(getter);
args.setThis(ObjectValue(*current));
bool ok = Invoke(cx, args);
*vp = args.rval();
return ok;
}
/* Otherwise it's a PropertyOp-based property. XXX handle this! */
MOZ_NOT_REACHED("NYI: handle PropertyOp'd properties here");
return false;
} while (false);
MOZ_NOT_REACHED("buggy control flow");
return false;
}
示例5: rootDesc
bool
js::GetProperty(JSContext *cx, Handle<ObjectImpl*> obj, Handle<ObjectImpl*> receiver,
Handle<PropertyId> pid, unsigned resolveFlags, MutableHandle<Value> vp)
{
NEW_OBJECT_REPRESENTATION_ONLY();
MOZ_ASSERT(receiver);
Rooted<ObjectImpl*> current(cx, obj);
do {
MOZ_ASSERT(obj);
if (Downcast(current)->isProxy()) {
MOZ_NOT_REACHED("NYI: proxy [[GetP]]");
return false;
}
PropDesc desc;
PropDesc::AutoRooter rootDesc(cx, &desc);
if (!GetOwnProperty(cx, current, pid, resolveFlags, &desc))
return false;
/* No property? Recur or bottom out. */
if (desc.isUndefined()) {
current = current->getProto();
if (current)
continue;
vp.setUndefined();
return true;
}
/* If it's a data property, return the value. */
if (desc.isDataDescriptor()) {
vp.set(desc.value());
return true;
}
/* If it's an accessor property, call its [[Get]] with the receiver. */
if (desc.isAccessorDescriptor()) {
Rooted<Value> get(cx, desc.getterValue());
if (get.isUndefined()) {
vp.setUndefined();
return true;
}
InvokeArgsGuard args;
if (!cx->stack.pushInvokeArgs(cx, 0, &args))
return false;
args.setCallee(get);
args.setThis(ObjectValue(*receiver));
bool ok = Invoke(cx, args);
vp.set(args.rval());
return ok;
}
/* Otherwise it's a PropertyOp-based property. XXX handle this! */
MOZ_NOT_REACHED("NYI: handle PropertyOp'd properties here");
return false;
} while (false);
MOZ_NOT_REACHED("buggy control flow");
return false;
}
示例6: DefineElement
bool
js::SetElement(JSContext *cx, ObjectImpl *obj, ObjectImpl *receiver, uint32_t index,
const Value &v, bool *succeeded)
{
NEW_OBJECT_REPRESENTATION_ONLY();
do {
MOZ_ASSERT(obj);
if (static_cast<JSObject *>(obj)->isProxy()) { // XXX
MOZ_NOT_REACHED("NYI: proxy [[SetP]]");
return false;
}
PropDesc ownDesc;
if (!GetOwnElement(cx, obj, index, &ownDesc))
return false;
if (!ownDesc.isUndefined()) {
if (ownDesc.isDataDescriptor()) {
if (!ownDesc.writable()) {
*succeeded = false;
return true;
}
if (receiver == obj) {
PropDesc updateDesc = PropDesc::valueOnly(v);
return DefineElement(cx, receiver, index, updateDesc, false, succeeded);
}
PropDesc newDesc;
return DefineElement(cx, receiver, index, newDesc, false, succeeded);
}
if (ownDesc.isAccessorDescriptor()) {
Value setter = ownDesc.setterValue();
if (setter.isUndefined()) {
*succeeded = false;
return true;
}
InvokeArgsGuard args;
if (!cx->stack.pushInvokeArgs(cx, 1, &args))
return false;
/* Push set, receiver, and v as the sole argument. */
args.calleev() = setter;
args.thisv() = ObjectValue(*receiver);
args[0] = v;
*succeeded = true;
return Invoke(cx, args);
}
MOZ_NOT_REACHED("NYI: setting PropertyOp-based property");
return false;
}
obj = obj->getProto();
if (obj)
continue;
PropDesc newDesc(v, PropDesc::Writable, PropDesc::Enumerable, PropDesc::Configurable);
return DefineElement(cx, receiver, index, newDesc, false, succeeded);
} while (false);
MOZ_NOT_REACHED("buggy control flow");
return false;
}
示例7: ObjectValue
bool
js::GetElement(JSContext *cx, ObjectImpl *obj, ObjectImpl *receiver, uint32_t index,
Value *vp)
{
NEW_OBJECT_REPRESENTATION_ONLY();
do {
MOZ_ASSERT(obj);
if (static_cast<JSObject *>(obj)->isProxy()) { // XXX
MOZ_NOT_REACHED("NYI: proxy [[GetP]]");
return false;
}
PropDesc desc;
if (!GetOwnElement(cx, obj, index, &desc))
return false;
/* No property? Recur or bottom out. */
if (desc.isUndefined()) {
obj = obj->getProto();
if (obj)
continue;
vp->setUndefined();
return true;
}
/* If it's a data property, return the value. */
if (desc.isDataDescriptor()) {
*vp = desc.value();
return true;
}
/* If it's an accessor property, call its [[Get]] with the receiver. */
if (desc.isAccessorDescriptor()) {
Value get = desc.getterValue();
if (get.isUndefined()) {
vp->setUndefined();
return true;
}
InvokeArgsGuard args;
if (!cx->stack.pushInvokeArgs(cx, 0, &args))
return false;
/* Push get, receiver, and no args. */
args.calleev() = get;
args.thisv() = ObjectValue(*receiver);
bool ok = Invoke(cx, args);
*vp = args.rval();
return ok;
}
/* Otherwise it's a PropertyOp-based property. XXX handle this! */
MOZ_NOT_REACHED("NYI: handle PropertyOp'd properties here");
return false;
} while (false);
MOZ_NOT_REACHED("buggy control flow");
return false;
}