本文整理汇总了C++中PutPropertySlot::type方法的典型用法代码示例。如果您正苦于以下问题:C++ PutPropertySlot::type方法的具体用法?C++ PutPropertySlot::type怎么用?C++ PutPropertySlot::type使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PutPropertySlot
的用法示例。
在下文中一共展示了PutPropertySlot::type方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defineSetter
void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes)
{
JSValue object = getDirect(propertyName);
if (object && object.isGetterSetter()) {
ASSERT(m_structure->hasGetterSetterProperties());
asGetterSetter(object)->setSetter(setterFunction);
return;
}
PutPropertySlot slot;
GetterSetter* getterSetter = new (exec) GetterSetter(exec);
putDirectInternal(exec->globalData(), propertyName, getterSetter, attributes | Setter, true, slot);
// putDirect will change our Structure if we add a new property. For
// getters and setters, though, we also need to change our Structure
// if we override an existing non-getter or non-setter.
if (slot.type() != PutPropertySlot::NewProperty) {
if (!m_structure->isDictionary()) {
RefPtr<Structure> structure = Structure::getterSetterTransition(m_structure);
setStructure(structure.release());
}
}
m_structure->setHasGetterSetterProperties(true);
getterSetter->setSetter(setterFunction);
}
示例2: defineSetter
void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction)
{
JSValue* object = getDirect(propertyName);
if (object && object->isGetterSetter()) {
ASSERT(m_structureID->hasGetterSetterProperties());
asGetterSetter(object)->setSetter(setterFunction);
return;
}
PutPropertySlot slot;
GetterSetter* getterSetter = new (exec) GetterSetter;
putDirect(propertyName, getterSetter, None, true, slot);
// putDirect will change our StructureID if we add a new property. For
// getters and setters, though, we also need to change our StructureID
// if we override an existing non-getter or non-setter.
if (slot.type() != PutPropertySlot::NewProperty) {
if (!m_structureID->isDictionary()) {
RefPtr<StructureID> structureID = StructureID::getterSetterTransition(m_structureID);
setStructureID(structureID.release());
}
}
m_structureID->setHasGetterSetterProperties(true);
getterSetter->setSetter(setterFunction);
}