Bug 978238 - Part 1: Clean up PropDesc<->PropertyDescriptor conversions. (r=jorendorff)

This commit is contained in:
Eric Faust
2014-06-03 13:23:02 -07:00
parent 7379f9c4a8
commit a24a95eb09
3 changed files with 25 additions and 5 deletions

View File

@@ -277,6 +277,9 @@ PropDesc::initFromPropertyDescriptor(Handle<PropertyDescriptor> desc)
{
MOZ_ASSERT(isUndefined());
if (!desc.object())
return;
isUndefined_ = false;
descObj_ = nullptr;
attrs = uint8_t(desc.attributes());
@@ -306,6 +309,21 @@ PropDesc::initFromPropertyDescriptor(Handle<PropertyDescriptor> desc)
hasConfigurable_ = true;
}
void
PropDesc::populatePropertyDescriptor(HandleObject obj, MutableHandle<PropertyDescriptor> desc) const
{
if (isUndefined()) {
desc.object().set(nullptr);
return;
}
desc.value().set(hasValue() ? value() : UndefinedValue());
desc.setGetter(getter());
desc.setSetter(setter());
desc.setAttributes(attributes());
desc.object().set(obj);
}
bool
PropDesc::makeObject(JSContext *cx)
{