本文整理汇总了C++中PropertyName::isSymbol方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyName::isSymbol方法的具体用法?C++ PropertyName::isSymbol怎么用?C++ PropertyName::isSymbol使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyName
的用法示例。
在下文中一共展示了PropertyName::isSymbol方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: putDelegate
bool JSStorage::putDelegate(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot&, bool& putResult)
{
// Only perform the custom put if the object doesn't have a native property by this name.
// Since hasProperty() would end up calling canGetItemsForName() and be fooled, we need to check
// the native property slots manually.
PropertySlot slot(this, PropertySlot::InternalMethodType::GetOwnProperty);
static_assert(!hasStaticPropertyTable, "This function does not handle static instance properties");
JSValue prototype = this->getPrototypeDirect();
if (prototype.isObject() && asObject(prototype)->getPropertySlot(exec, propertyName, slot))
return false;
if (propertyName.isSymbol())
return false;
String stringValue = value.toString(exec)->value(exec);
if (exec->hadException()) {
// The return value indicates whether putDelegate() should handle the put operation (which
// if true, tells the caller not to execute the generic put). It does not indicate whether
// putDelegate() did successfully complete the operation or not (which it didn't in this
// case due to the exception).
putResult = false;
return true;
}
ExceptionCode ec = 0;
wrapped().setItem(propertyNameToString(propertyName), stringValue, ec);
setDOMException(exec, ec);
putResult = !ec;
return true;
}
示例2: putDelegate
bool JSStorage::putDelegate(ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot&, bool& putResult)
{
VM& vm = state->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
// Only perform the custom put if the object doesn't have a native property by this name.
// Since hasProperty() would end up calling canGetItemsForName() and be fooled, we need to check
// the native property slots manually.
PropertySlot slot { this, PropertySlot::InternalMethodType::GetOwnProperty };
JSValue prototype = this->getPrototypeDirect();
if (prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))
return false;
if (propertyName.isSymbol())
return false;
String stringValue = value.toWTFString(state);
RETURN_IF_EXCEPTION(scope, true);
auto setItemResult = wrapped().setItem(propertyNameToString(propertyName), stringValue);
if (setItemResult.hasException()) {
propagateException(*state, scope, setItemResult.releaseException());
return true;
}
putResult = true;
return true;
}
示例3: putDelegate
bool JSStorage::putDelegate(ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot&)
{
// Only perform the custom put if the object doesn't have a native property by this name.
// Since hasProperty() would end up calling canGetItemsForName() and be fooled, we need to check
// the native property slots manually.
PropertySlot slot(this);
if (getStaticValueSlot<JSStorage, Base>(exec, *s_info.staticPropHashTable, this, propertyName, slot))
return false;
JSValue prototype = this->prototype();
if (prototype.isObject() && asObject(prototype)->getPropertySlot(exec, propertyName, slot))
return false;
if (propertyName.isSymbol())
return false;
String stringValue = value.toString(exec)->value(exec);
if (exec->hadException())
return true;
ExceptionCode ec = 0;
wrapped().setItem(propertyNameToString(propertyName), stringValue, ec);
setDOMException(exec, ec);
return true;
}
示例4: getOwnPropertySlot
bool JSModuleNamespaceObject::getOwnPropertySlot(JSObject* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
// http://www.ecma-international.org/ecma-262/6.0/#sec-module-namespace-exotic-objects-getownproperty-p
JSModuleNamespaceObject* thisObject = jsCast<JSModuleNamespaceObject*>(cell);
// step 1.
// If the property name is a symbol, we don't look into the imported bindings.
// It may return the descriptor with writable: true, but namespace objects does not allow it in [[Set]] / [[DefineOwnProperty]] side.
if (propertyName.isSymbol())
return JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot);
if (!thisObject->m_exports.contains(propertyName.uid()))
return false;
// https://esdiscuss.org/topic/march-24-meeting-notes
// http://www.ecma-international.org/ecma-262/6.0/#sec-module-namespace-exotic-objects-getownproperty-p
// section 9.4.6.5, step 6.
// This property will be seen as writable: true, enumerable:true, configurable: false.
// But this does not mean that this property is writable by users.
//
// In JSC, getOwnPropertySlot is not designed to throw any errors. But looking up the value from the module
// environment may throw error if the loaded variable is the TDZ value. To workaround, we set the custom
// getter function. When it is called, it looks up the variable and throws an error if the variable is not
// initialized.
slot.setCustom(thisObject, DontDelete, callbackGetter);
return true;
}
示例5: nameGetter
bool JSStorage::nameGetter(ExecState* exec, PropertyName propertyName, JSValue& value)
{
if (propertyName.isSymbol())
return false;
ExceptionCode ec = 0;
String item = wrapped().getItem(propertyNameToString(propertyName), ec);
setDOMException(exec, ec);
if (item.isNull())
return false;
value = jsStringWithCache(exec, item);
return true;
}
示例6: nameGetter
bool JSStorage::nameGetter(ExecState* state, PropertyName propertyName, JSValue& value)
{
if (propertyName.isSymbol())
return false;
auto item = wrapped().getItem(propertyNameToString(propertyName));
if (item.hasException()) {
auto& vm = state->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
propagateException(*state, scope, item.releaseException());
return false;
}
auto string = item.releaseReturnValue();
if (string.isNull())
return false;
value = jsStringWithCache(state, string);
return true;
}
示例7: deleteProperty
bool JSStorage::deleteProperty(JSCell* cell, ExecState* state, PropertyName propertyName)
{
auto& thisObject = *jsCast<JSStorage*>(cell);
// Only perform the custom delete if the object doesn't have a native property by this name.
// Since hasProperty() would end up calling canGetItemsForName() and be fooled, we need to check
// the native property slots manually.
PropertySlot slot(&thisObject, PropertySlot::InternalMethodType::GetOwnProperty);
JSValue prototype = thisObject.getPrototypeDirect();
if (prototype.isObject() && asObject(prototype)->getPropertySlot(state, propertyName, slot))
return Base::deleteProperty(&thisObject, state, propertyName);
if (propertyName.isSymbol())
return Base::deleteProperty(&thisObject, state, propertyName);
VM& vm = state->vm();
auto scope = DECLARE_THROW_SCOPE(vm);
propagateException(*state, scope, thisObject.wrapped().removeItem(propertyNameToString(propertyName)));
return true;
}
示例8: deleteProperty
bool JSStorage::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
{
JSStorage* thisObject = jsCast<JSStorage*>(cell);
// Only perform the custom delete if the object doesn't have a native property by this name.
// Since hasProperty() would end up calling canGetItemsForName() and be fooled, we need to check
// the native property slots manually.
PropertySlot slot(thisObject, PropertySlot::InternalMethodType::GetOwnProperty);
static_assert(!hasStaticPropertyTable, "This function does not handle static instance properties");
JSValue prototype = thisObject->getPrototypeDirect();
if (prototype.isObject() && asObject(prototype)->getPropertySlot(exec, propertyName, slot))
return Base::deleteProperty(thisObject, exec, propertyName);
if (propertyName.isSymbol())
return Base::deleteProperty(thisObject, exec, propertyName);
ExceptionCode ec = 0;
thisObject->wrapped().removeItem(propertyNameToString(propertyName), ec);
setDOMException(exec, ec);
return true;
}
示例9: deleteProperty
bool JSStorage::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
{
JSStorage* thisObject = jsCast<JSStorage*>(cell);
// Only perform the custom delete if the object doesn't have a native property by this name.
// Since hasProperty() would end up calling canGetItemsForName() and be fooled, we need to check
// the native property slots manually.
PropertySlot slot(thisObject);
if (getStaticValueSlot<JSStorage, Base>(exec, *s_info.staticPropHashTable, thisObject, propertyName, slot))
return Base::deleteProperty(thisObject, exec, propertyName);
JSValue prototype = thisObject->prototype();
if (prototype.isObject() && asObject(prototype)->getPropertySlot(exec, propertyName, slot))
return Base::deleteProperty(thisObject, exec, propertyName);
if (propertyName.isSymbol())
return Base::deleteProperty(thisObject, exec, propertyName);
ExceptionCode ec = 0;
thisObject->wrapped().removeItem(propertyNameToString(propertyName), ec);
setDOMException(exec, ec);
return true;
}
示例10: canGetItemsForName
bool JSStyleSheetList::canGetItemsForName(ExecState*, StyleSheetList* styleSheetList, PropertyName propertyName)
{
if (propertyName.isSymbol())
return false;
return styleSheetList->getNamedItem(propertyNameToString(propertyName));
}