本文整理汇总了C++中JSString::toIdentifier方法的典型用法代码示例。如果您正苦于以下问题:C++ JSString::toIdentifier方法的具体用法?C++ JSString::toIdentifier怎么用?C++ JSString::toIdentifier使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JSString
的用法示例。
在下文中一共展示了JSString::toIdentifier方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: next
bool JSPropertyNameIterator::next(ExecState* exec, JSValue& output)
{
if (m_enumerationPhase == EnumerationPhase::IndexedNames) {
for (; m_cursor < m_propertyNameEnumerator->indexedLength();) {
uint32_t index = m_cursor++;
if (m_iteratedObject->hasProperty(exec, index)) {
output = jsString(exec, Identifier::from(exec, index).string());
return true;
}
}
m_cursor = 0;
m_enumerationPhase = EnumerationPhase::StructureNames;
}
if (m_enumerationPhase == EnumerationPhase::StructureNames) {
for (; m_cursor < m_propertyNameEnumerator->endStructurePropertyIndex();) {
uint32_t index = m_cursor++;
JSString* propertyName = m_propertyNameEnumerator->propertyNameAtIndex(index);
ASSERT(propertyName);
if (m_iteratedObject->structure(exec->vm())->id() == m_propertyNameEnumerator->cachedStructureID()) {
output = propertyName;
return true;
}
if (m_iteratedObject->hasProperty(exec, propertyName->toIdentifier(exec))) {
output = propertyName;
return true;
}
}
ASSERT(m_cursor >= m_propertyNameEnumerator->endStructurePropertyIndex());
// Use the same m_cursor in the GenericNames phase.
m_enumerationPhase = EnumerationPhase::GenericNames;
}
if (m_enumerationPhase == EnumerationPhase::GenericNames) {
for (; m_cursor < m_propertyNameEnumerator->endGenericPropertyIndex();) {
uint32_t index = m_cursor++;
JSString* propertyName = m_propertyNameEnumerator->propertyNameAtIndex(index);
ASSERT(propertyName);
if (m_iteratedObject->hasProperty(exec, propertyName->toIdentifier(exec))) {
output = propertyName;
return true;
}
}
m_enumerationPhase = EnumerationPhase::Done;
}
return false;
}