当前位置: 首页>>代码示例>>C++>>正文


C++ PropertyName::isSymbol方法代码示例

本文整理汇总了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;
}
开发者ID:edcwconan,项目名称:webkit,代码行数:31,代码来源:JSStorageCustom.cpp

示例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;
}
开发者ID:,项目名称:,代码行数:29,代码来源:

示例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;
}
开发者ID:hnney,项目名称:webkit,代码行数:26,代码来源:JSStorageCustom.cpp

示例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;
}
开发者ID:robdharris,项目名称:webkit,代码行数:28,代码来源:JSModuleNamespaceObject.cpp

示例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;
}
开发者ID:edcwconan,项目名称:webkit,代码行数:15,代码来源:JSStorageCustom.cpp

示例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;
}
开发者ID:,项目名称:,代码行数:20,代码来源:

示例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;
}
开发者ID:,项目名称:,代码行数:21,代码来源:

示例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;
}
开发者ID:edcwconan,项目名称:webkit,代码行数:22,代码来源:JSStorageCustom.cpp

示例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;
}
开发者ID:hnney,项目名称:webkit,代码行数:22,代码来源:JSStorageCustom.cpp

示例10: canGetItemsForName

bool JSStyleSheetList::canGetItemsForName(ExecState*, StyleSheetList* styleSheetList, PropertyName propertyName)
{
    if (propertyName.isSymbol())
        return false;
    return styleSheetList->getNamedItem(propertyNameToString(propertyName));
}
开发者ID:biddyweb,项目名称:switch-oss,代码行数:6,代码来源:JSStyleSheetListCustom.cpp


注:本文中的PropertyName::isSymbol方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。