本文整理汇总了C++中Arguments::argument方法的典型用法代码示例。如果您正苦于以下问题:C++ Arguments::argument方法的具体用法?C++ Arguments::argument怎么用?C++ Arguments::argument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Arguments
的用法示例。
在下文中一共展示了Arguments::argument方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: defineOwnProperty
bool Arguments::defineOwnProperty(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor, bool shouldThrow)
{
Arguments* thisObject = jsCast<Arguments*>(object);
unsigned i = propertyName.asIndex();
if (i < thisObject->d->numArguments) {
ASSERT(i < PropertyName::NotAnIndex);
// If the property is not yet present on the object, and is not yet marked as deleted, then add it now.
PropertySlot slot;
if ((!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i]) && !JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot))
object->putDirect(exec->globalData(), propertyName, thisObject->argument(i).get(), 0);
if (!Base::defineOwnProperty(object, exec, propertyName, descriptor, shouldThrow))
return false;
if (!thisObject->d->deletedArguments) {
thisObject->d->deletedArguments = adoptArrayPtr(new bool[thisObject->d->numArguments]);
memset(thisObject->d->deletedArguments.get(), 0, sizeof(bool) * thisObject->d->numArguments);
}
// From ES 5.1, 10.6 Arguments Object
// 5. If the value of isMapped is not undefined, then
if (!thisObject->d->deletedArguments[i]) {
// a. If IsAccessorDescriptor(Desc) is true, then
if (descriptor.isAccessorDescriptor()) {
// i. Call the [[Delete]] internal method of map passing P, and false as the arguments.
thisObject->d->deletedArguments[i] = true;
} else { // b. Else
// i. If Desc.[[Value]] is present, then
// 1. Call the [[Put]] internal method of map passing P, Desc.[[Value]], and Throw as the arguments.
if (descriptor.value())
thisObject->argument(i).set(exec->globalData(), thisObject, descriptor.value());
// ii. If Desc.[[Writable]] is present and its value is false, then
// 1. Call the [[Delete]] internal method of map passing P and false as arguments.
if (descriptor.writablePresent() && !descriptor.writable())
thisObject->d->deletedArguments[i] = true;
}
}
return true;
}
if (propertyName == exec->propertyNames().length && !thisObject->d->overrodeLength) {
thisObject->putDirect(exec->globalData(), propertyName, jsNumber(thisObject->d->numArguments), DontEnum);
thisObject->d->overrodeLength = true;
} else if (propertyName == exec->propertyNames().callee && !thisObject->d->overrodeCallee) {
thisObject->putDirect(exec->globalData(), propertyName, thisObject->d->callee.get(), DontEnum);
thisObject->d->overrodeCallee = true;
} else if (propertyName == exec->propertyNames().caller && thisObject->d->isStrictMode)
thisObject->createStrictModeCallerIfNecessary(exec);
return Base::defineOwnProperty(object, exec, propertyName, descriptor, shouldThrow);
}
示例2: put
void Arguments::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
{
Arguments* thisObject = jsCast<Arguments*>(cell);
unsigned i = propertyName.asIndex();
if (i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) {
ASSERT(i < PropertyName::NotAnIndex);
thisObject->argument(i).set(exec->globalData(), thisObject, value);
return;
}
if (propertyName == exec->propertyNames().length && !thisObject->d->overrodeLength) {
thisObject->d->overrodeLength = true;
thisObject->putDirect(exec->globalData(), propertyName, value, DontEnum);
return;
}
if (propertyName == exec->propertyNames().callee && !thisObject->d->overrodeCallee) {
if (!thisObject->d->isStrictMode) {
thisObject->d->overrodeCallee = true;
thisObject->putDirect(exec->globalData(), propertyName, value, DontEnum);
return;
}
thisObject->createStrictModeCalleeIfNecessary(exec);
}
if (propertyName == exec->propertyNames().caller && thisObject->d->isStrictMode)
thisObject->createStrictModeCallerIfNecessary(exec);
JSObject::put(thisObject, exec, propertyName, value, slot);
}
示例3: getOwnPropertyDescriptor
bool Arguments::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, PropertyName propertyName, PropertyDescriptor& descriptor)
{
Arguments* thisObject = jsCast<Arguments*>(object);
unsigned i = propertyName.asIndex();
if (i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) {
ASSERT(i < PropertyName::NotAnIndex);
descriptor.setDescriptor(thisObject->argument(i).get(), None);
return true;
}
if (propertyName == exec->propertyNames().length && LIKELY(!thisObject->d->overrodeLength)) {
descriptor.setDescriptor(jsNumber(thisObject->d->numArguments), DontEnum);
return true;
}
if (propertyName == exec->propertyNames().callee && LIKELY(!thisObject->d->overrodeCallee)) {
if (!thisObject->d->isStrictMode) {
descriptor.setDescriptor(thisObject->d->callee.get(), DontEnum);
return true;
}
thisObject->createStrictModeCalleeIfNecessary(exec);
}
if (propertyName == exec->propertyNames().caller && thisObject->d->isStrictMode)
thisObject->createStrictModeCallerIfNecessary(exec);
return JSObject::getOwnPropertyDescriptor(thisObject, exec, propertyName, descriptor);
}
示例4: getOwnPropertySlot
bool Arguments::getOwnPropertySlot(JSCell* cell, ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
Arguments* thisObject = jsCast<Arguments*>(cell);
unsigned i = propertyName.asIndex();
if (i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) {
ASSERT(i < PropertyName::NotAnIndex);
slot.setValue(thisObject->argument(i).get());
return true;
}
if (propertyName == exec->propertyNames().length && LIKELY(!thisObject->d->overrodeLength)) {
slot.setValue(jsNumber(thisObject->d->numArguments));
return true;
}
if (propertyName == exec->propertyNames().callee && LIKELY(!thisObject->d->overrodeCallee)) {
if (!thisObject->d->isStrictMode) {
slot.setValue(thisObject->d->callee.get());
return true;
}
thisObject->createStrictModeCalleeIfNecessary(exec);
}
if (propertyName == exec->propertyNames().caller && thisObject->d->isStrictMode)
thisObject->createStrictModeCallerIfNecessary(exec);
return JSObject::getOwnPropertySlot(thisObject, exec, propertyName, slot);
}
示例5: getOwnPropertySlotByIndex
bool Arguments::getOwnPropertySlotByIndex(JSCell* cell, ExecState* exec, unsigned i, PropertySlot& slot)
{
Arguments* thisObject = jsCast<Arguments*>(cell);
if (i < thisObject->d->numArguments && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) {
slot.setValue(thisObject->argument(i).get());
return true;
}
return JSObject::getOwnPropertySlot(thisObject, exec, Identifier(exec, UString::number(i)), slot);
}
示例6: putByIndex
void Arguments::putByIndex(JSCell* cell, ExecState* exec, unsigned i, JSValue value, bool shouldThrow)
{
Arguments* thisObject = jsCast<Arguments*>(cell);
if (i < static_cast<unsigned>(thisObject->d->numArguments) && (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])) {
thisObject->argument(i).set(exec->globalData(), thisObject, value);
return;
}
PutPropertySlot slot(shouldThrow);
JSObject::put(thisObject, exec, Identifier(exec, UString::number(i)), value, slot);
}