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


C++ JSPropertyNameIterator类代码示例

本文整理汇总了C++中JSPropertyNameIterator的典型用法代码示例。如果您正苦于以下问题:C++ JSPropertyNameIterator类的具体用法?C++ JSPropertyNameIterator怎么用?C++ JSPropertyNameIterator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了JSPropertyNameIterator类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: new

JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, Structure* structure, JSObject* iteratedObject, JSPropertyNameEnumerator* enumerator)
{
    VM& vm = exec->vm();
    JSPropertyNameIterator* instance = new (NotNull, allocateCell<JSPropertyNameIterator>(vm.heap)) JSPropertyNameIterator(vm, structure, iteratedObject, enumerator);
    instance->finishCreation(vm, structure->globalObject());
    return instance;
}
开发者ID:endlessm,项目名称:WebKit,代码行数:7,代码来源:JSPropertyNameIterator.cpp

示例2: ASSERT

JSPropertyNameIterator* JSPropertyNameIterator::create(ExecState* exec, JSObject* o)
{
    ASSERT(!o->structure()->enumerationCache() ||
            o->structure()->enumerationCache()->cachedStructure() != o->structure() ||
            o->structure()->enumerationCache()->cachedPrototypeChain() != o->structure()->prototypeChain(exec));

    PropertyNameArray propertyNames(exec);
    o->getPropertyNames(exec, propertyNames);
    size_t numCacheableSlots = 0;
    if (!o->structure()->hasNonEnumerableProperties() && !o->structure()->hasAnonymousSlots() &&
        !o->structure()->isUncacheableDictionary() && !o->structure()->typeInfo().overridesGetPropertyNames())
        numCacheableSlots = o->structure()->propertyStorageSize();

    JSPropertyNameIterator* jsPropertyNameIterator = new (exec) JSPropertyNameIterator(exec, propertyNames.data(), numCacheableSlots);

    if (o->structure()->isDictionary())
        return jsPropertyNameIterator;

    if (o->structure()->typeInfo().overridesGetPropertyNames())
        return jsPropertyNameIterator;
    
    size_t count = normalizePrototypeChain(exec, o);
    StructureChain* structureChain = o->structure()->prototypeChain(exec);
    RefPtr<Structure>* structure = structureChain->head();
    for (size_t i = 0; i < count; ++i) {
        if (structure[i]->typeInfo().overridesGetPropertyNames())
            return jsPropertyNameIterator;
    }

    jsPropertyNameIterator->setCachedPrototypeChain(structureChain);
    jsPropertyNameIterator->setCachedStructure(o->structure());
    o->structure()->setEnumerationCache(jsPropertyNameIterator);
    return jsPropertyNameIterator;
}
开发者ID:Mr-Kumar-Abhishek,项目名称:qt,代码行数:34,代码来源:JSPropertyNameIterator.cpp

示例3: visitChildren

void JSPropertyNameIterator::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
    JSPropertyNameIterator* thisObject = jsCast<JSPropertyNameIterator*>(cell);
    ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info);
    ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren());
    visitor.appendValues(thisObject->m_jsStrings.get(), thisObject->m_jsStringsSize);
        visitor.append(&thisObject->m_cachedPrototypeChain);
}
开发者ID:166MMX,项目名称:openjdk.java.net-openjfx-8u40-rt,代码行数:8,代码来源:JSPropertyNameIterator.cpp

示例4: propertyNameIteratorFuncNext

EncodedJSValue JSC_HOST_CALL propertyNameIteratorFuncNext(ExecState* exec)
{
    VM& vm = exec->vm();
    auto scope = DECLARE_THROW_SCOPE(vm);

    JSPropertyNameIterator* iterator = jsDynamicCast<JSPropertyNameIterator*>(exec->thisValue());
    if (!iterator)
        return JSValue::encode(throwTypeError(exec, scope, ASCIILiteral("Cannot call PropertyNameIterator.next() on a non-PropertyNameIterator object")));

    JSValue result;
    if (iterator->next(exec, result))
        return JSValue::encode(createIteratorResultObject(exec, result, false));
    return JSValue::encode(createIteratorResultObject(exec, jsUndefined(), true));
}
开发者ID:endlessm,项目名称:WebKit,代码行数:14,代码来源:JSPropertyNameIterator.cpp


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