Cleans up the qv4object class definition.
Change-Id: Ifca7f89afb3affce5d940b1b4f7dcfe71779012c
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
return Value::undefinedValue();
}
- Value result = instance->getValueChecked(ctx, instance->front());
+ PropertyDescriptor *front = 0;
+ if (!instance->sparseArray) {
+ if (instance->arrayDataLen)
+ front = instance->arrayData;
+ } else {
+ SparseArrayNode *n = instance->sparseArray->findNode(0);
+ if (n)
+ front = instance->arrayDecriptor(n->value);
+ }
+ if (front && front->type == PropertyDescriptor::Generic)
+ front = 0;
+
+ Value result = instance->getValueChecked(ctx, front);
bool protoHasArray = false;
Object *p = instance;
bool Object::__delete__(ExecutionContext *ctx, uint index)
{
- if (deleteArrayIndex(index))
+ PropertyDescriptor *pd = 0;
+ if (!sparseArray) {
+ if (index >= arrayDataLen)
+ return true;
+ pd = arrayAt(index);
+ } else {
+ SparseArrayNode *n = sparseArray->findNode(index);
+ if (n)
+ pd = arrayDecriptor(n->value);
+ }
+ if (!pd || pd->type == PropertyDescriptor::Generic)
return true;
+
+ if (pd->isConfigurable()) {
+ pd->type = PropertyDescriptor::Generic;
+ pd->value = Value::undefinedValue();
+ if (sparseArray) {
+ pd->value.int_32 = arrayFreeList;
+ arrayFreeList = pd - arrayData;
+ }
+ return true;
+ }
+
if (ctx->strictMode)
__qmljs_throw_type_error(ctx);
return false;
fillDescriptor(pd, value);
}
- bool deleteArrayIndex(uint index) {
- PropertyDescriptor *pd = 0;
- if (!sparseArray) {
- if (index >= arrayDataLen)
- return true;
- pd = arrayAt(index);
- } else {
- SparseArrayNode *n = sparseArray->findNode(index);
- if (n)
- pd = arrayDecriptor(n->value);
- }
- if (!pd || pd->type == PropertyDescriptor::Generic)
- return true;
- if (!pd->isConfigurable())
- return false;
- pd->type = PropertyDescriptor::Generic;
- pd->value = Value::undefinedValue();
- if (sparseArray) {
- pd->value.int_32 = arrayFreeList;
- arrayFreeList = pd - arrayData;
- }
- return true;
- }
-
PropertyDescriptor *arrayAt(uint index) const {
if (!sparseArray) {
if (index >= arrayDataLen)
void markArrayObjects() const;
- PropertyDescriptor *front() {
- PropertyDescriptor *pd = 0;
- if (!sparseArray) {
- if (arrayDataLen)
- pd = arrayData;
- } else {
- SparseArrayNode *n = sparseArray->findNode(0);
- if (n)
- pd = arrayDecriptor(n->value);
- }
- if (pd && pd->type == PropertyDescriptor::Generic)
- return 0;
- return pd;
- }
void push_back(Value v) {
uint idx = arrayLength();
if (!sparseArray) {