本文整理汇总了C++中Identifier::ustring方法的典型用法代码示例。如果您正苦于以下问题:C++ Identifier::ustring方法的具体用法?C++ Identifier::ustring怎么用?C++ Identifier::ustring使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Identifier
的用法示例。
在下文中一共展示了Identifier::ustring方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateFuncExprNodeProfilerIdent
void updateFuncExprNodeProfilerIdent(ExpressionNode* node, const ExpressionNode* base, const Identifier& ident)
{
ASSERT(node);
ASSERT(node->isFuncExprNode());
FuncExprNode* funcExprNode = static_cast<FuncExprNode*>(node);
if (base) {
UString name(ident.ustring());
const UString dotString(".");
const ExpressionNode* baseIterator = base;
while (baseIterator && baseIterator->isDotAccessorNode()) {
const DotAccessorNode* const dotAccessorNode = static_cast<const DotAccessorNode*>(baseIterator);
name = makeString(dotAccessorNode->identifier().ustring(), dotString, name);
baseIterator = dotAccessorNode->base();
}
if (baseIterator && baseIterator->isResolveNode()) {
const ResolveNode* const resolveNode = static_cast<const ResolveNode*>(baseIterator);
name = makeString(resolveNode->identifier().ustring(), dotString, name);
}
funcExprNode->body()->setContextualName(name);
} else {
funcExprNode->body()->setContextualName(ident.ustring());
}
}
示例2: methodsNamed
MethodList BalClass::methodsNamed(const Identifier& identifier, Instance* instance) const
{
MethodList methodList;
Method* method = m_methods.get(identifier.ustring().rep());
if (method) {
methodList.append(method);
return methodList;
}
const UChar* ident16 = identifier.ustring().data();
char ident[256];
sprintf(ident,"%S",ident16);
ident[identifier.ustring().size()] = '\0';
const BalInstance* inst = static_cast<const BalInstance*>(instance);
BalObject* obj = inst->getObject();
if( obj->hasMethod( ident ) )
{
BalMethod *aMethod= new BalMethod(obj, 0, ident, 0);
m_methods.set(identifier.ustring().rep(), aMethod);
methodList.append(aMethod);
}
return methodList;
}
示例3: methodsNamed
MethodList BalClass::methodsNamed(const Identifier& identifier, Instance* instance) const
{
MethodList methodList;
Method* method = m_methods.get(identifier.ustring().rep());
if (method) {
methodList.append(method);
return methodList;
}
const char *ident = identifier.ascii();
const BalInstance* inst = static_cast<const BalInstance*>(instance);
BalObject* obj = inst->getObject();
if( obj->hasMethod( ident ) )
{
Method* aMethod = new BalMethod(ident); // deleted in the CClass destructor
{
JSLock lock(false);
m_methods.set(identifier.ustring().rep(), aMethod);
}
methodList.append(aMethod);
}
return methodList;
}
示例4: ASSERT
PassRefPtr<Structure> Structure::addPropertyTransition(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset)
{
ASSERT(!structure->isDictionary());
ASSERT(structure->typeInfo().type() == ObjectType);
ASSERT(!Structure::addPropertyTransitionToExistingStructure(structure, propertyName, attributes, specificValue, offset));
if (structure->m_specificFunctionThrashCount == maxSpecificFunctionThrashCount)
specificValue = 0;
if (structure->transitionCount() > s_maxTransitionLength) {
RefPtr<Structure> transition = toCacheableDictionaryTransition(structure);
ASSERT(structure != transition);
offset = transition->put(propertyName, attributes, specificValue);
ASSERT(offset >= structure->m_anonymousSlotCount);
ASSERT(structure->m_anonymousSlotCount == transition->m_anonymousSlotCount);
if (transition->propertyStorageSize() > transition->propertyStorageCapacity())
transition->growPropertyStorageCapacity();
return transition.release();
}
RefPtr<Structure> transition = create(structure->m_prototype, structure->typeInfo(), structure->anonymousSlotCount());
transition->m_cachedPrototypeChain = structure->m_cachedPrototypeChain;
transition->m_previous = structure;
transition->m_nameInPrevious = propertyName.ustring().rep();
transition->m_attributesInPrevious = attributes;
transition->m_specificValueInPrevious = specificValue;
transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity;
transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties;
transition->m_hasNonEnumerableProperties = structure->m_hasNonEnumerableProperties;
transition->m_specificFunctionThrashCount = structure->m_specificFunctionThrashCount;
if (structure->m_propertyTable) {
if (structure->m_isPinnedPropertyTable)
transition->m_propertyTable = structure->copyPropertyTable();
else {
transition->m_propertyTable = structure->m_propertyTable;
structure->m_propertyTable = 0;
}
} else {
if (structure->m_previous)
transition->materializePropertyMap();
else
transition->createPropertyMapHashTable();
}
offset = transition->put(propertyName, attributes, specificValue);
ASSERT(offset >= structure->m_anonymousSlotCount);
ASSERT(structure->m_anonymousSlotCount == transition->m_anonymousSlotCount);
if (transition->propertyStorageSize() > transition->propertyStorageCapacity())
transition->growPropertyStorageCapacity();
transition->m_offset = offset - structure->m_anonymousSlotCount;
ASSERT(structure->anonymousSlotCount() == transition->anonymousSlotCount());
structure->transitionTableAdd(make_pair(propertyName.ustring().rep(), attributes), transition.get(), specificValue);
return transition.release();
}
示例5: ASSERT
PassRefPtr<Structure> Structure::addPropertyTransition(Structure* structure, const Identifier& propertyName, unsigned attributes, size_t& offset)
{
ASSERT(!structure->m_isDictionary);
ASSERT(structure->typeInfo().type() == ObjectType);
ASSERT(!Structure::addPropertyTransitionToExistingStructure(structure, propertyName, attributes, offset));
if (structure->transitionCount() > s_maxTransitionLength) {
RefPtr<Structure> transition = toDictionaryTransition(structure);
offset = transition->put(propertyName, attributes);
if (transition->propertyStorageSize() > transition->propertyStorageCapacity())
transition->growPropertyStorageCapacity();
return transition.release();
}
RefPtr<Structure> transition = create(structure->m_prototype, structure->typeInfo());
transition->m_cachedPrototypeChain = structure->m_cachedPrototypeChain;
transition->m_previous = structure;
transition->m_nameInPrevious = propertyName.ustring().rep();
transition->m_attributesInPrevious = attributes;
transition->m_propertyStorageCapacity = structure->m_propertyStorageCapacity;
transition->m_hasGetterSetterProperties = structure->m_hasGetterSetterProperties;
if (structure->m_propertyTable) {
if (structure->m_isPinnedPropertyTable)
transition->m_propertyTable = structure->copyPropertyTable();
else {
transition->m_propertyTable = structure->m_propertyTable;
structure->m_propertyTable = 0;
}
} else {
if (structure->m_previous)
transition->materializePropertyMap();
else
transition->createPropertyMapHashTable();
}
offset = transition->put(propertyName, attributes);
if (transition->propertyStorageSize() > transition->propertyStorageCapacity())
transition->growPropertyStorageCapacity();
transition->m_offset = offset;
if (structure->m_usingSingleTransitionSlot) {
if (!structure->m_transitions.singleTransition) {
structure->m_transitions.singleTransition = transition.get();
return transition.release();
}
Structure* existingTransition = structure->m_transitions.singleTransition;
structure->m_usingSingleTransitionSlot = false;
StructureTransitionTable* transitionTable = new StructureTransitionTable;
structure->m_transitions.table = transitionTable;
transitionTable->add(make_pair(existingTransition->m_nameInPrevious.get(), +existingTransition->m_attributesInPrevious), existingTransition);
}
structure->m_transitions.table->add(make_pair(propertyName.ustring().rep(), attributes), transition.get());
return transition.release();
}
示例6: write
void write(const Identifier& ident)
{
UString str = ident.ustring();
pair<StringConstantPool::iterator, bool> iter = m_constantPool.add(str.impl(), m_constantPool.size());
if (!iter.second) {
write(StringPoolTag);
writeStringIndex(iter.first->second);
return;
}
// This condition is unlikely to happen as they would imply an ~8gb
// string but we should guard against it anyway
if (str.length() >= StringPoolTag) {
fail();
return;
}
// Guard against overflow
if (str.length() > (numeric_limits<uint32_t>::max() - sizeof(uint32_t)) / sizeof(UChar)) {
fail();
return;
}
writeLittleEndian<uint32_t>(m_buffer, str.length());
if (!writeLittleEndian<uint16_t>(m_buffer, reinterpret_cast<const uint16_t*>(str.characters()), str.length()))
fail();
}
示例7: find
int Lookup::find(const struct HashTable *table, const Identifier &s)
{
const HashEntry *entry = KJS::findEntry(table, s.ustring().rep()->hash(), s.data(), s.size());
if (entry)
return entry->value;
return -1;
}
示例8: add
void PropertyNameArray::add(const Identifier& ident)
{
if (!m_set.add(ident.ustring().rep()).second)
return;
m_vector.append(ident);
}
示例9: deleteProperty
bool JSVariableObject::deleteProperty(ExecState* exec, const Identifier& propertyName)
{
if (symbolTable().contains(propertyName.ustring().rep()))
return false;
return JSObject::deleteProperty(exec, propertyName);
}
示例10: methodsNamed
MethodList JavaClass::methodsNamed(const Identifier& identifier, Instance*) const
{
MethodList* methodList = m_methods.get(identifier.ustring().rep());
if (methodList)
return *methodList;
return MethodList();
}
示例11: getPropertyAttributes
bool JSVariableObject::getPropertyAttributes(ExecState* exec, const Identifier& propertyName, unsigned& attributes) const
{
SymbolTableEntry entry = symbolTable().get(propertyName.ustring().rep());
if (!entry.isNull()) {
attributes = entry.getAttributes() | DontDelete;
return true;
}
return JSObject::getPropertyAttributes(exec, propertyName, attributes);
}
示例12: symbolTableGet
bool JSVariableObject::symbolTableGet(const Identifier& propertyName, PropertyDescriptor& descriptor)
{
SymbolTableEntry entry = symbolTable().inlineGet(propertyName.ustring().rep());
if (!entry.isNull()) {
descriptor.setDescriptor(registerAt(entry.getIndex()).jsValue(), entry.getAttributes() | DontDelete);
return true;
}
return false;
}
示例13: value
JSValue PropertyNameForFunctionCall::value(ExecState* exec) const
{
if (!m_value) {
if (m_identifier)
m_value = jsString(exec, m_identifier->ustring());
else
m_value = jsNumber(m_number);
}
return m_value;
}
示例14: createUndefinedVariableError
JSValue createUndefinedVariableError(ExecState* exec, const Identifier& ident, unsigned bytecodeOffset, CodeBlock* codeBlock)
{
int startOffset = 0;
int endOffset = 0;
int divotPoint = 0;
int line = codeBlock->expressionRangeForBytecodeOffset(exec, bytecodeOffset, divotPoint, startOffset, endOffset);
UString message(makeUString("Can't find variable: ", ident.ustring()));
JSObject* exception = addErrorInfo(exec, createReferenceError(exec, message), line, codeBlock->ownerExecutable()->source(), divotPoint, startOffset, endOffset);
return exception;
}
示例15: ASSERT
PassRefPtr<Structure> Structure::addPropertyTransitionToExistingStructure(Structure* structure, const Identifier& propertyName, unsigned attributes, TiCell* specificValue, size_t& offset)
{
ASSERT(!structure->isDictionary());
ASSERT(structure->typeInfo().type() == ObjectType);
if (Structure* existingTransition = structure->table.get(make_pair(propertyName.ustring().rep(), attributes), specificValue)) {
ASSERT(existingTransition->m_offset != noOffset);
offset = existingTransition->m_offset;
return existingTransition;
}
return 0;
}