Rename Value::deletedValue() to Value::emptyValue()
authorLars Knoll <lars.knoll@digia.com>
Tue, 7 May 2013 10:56:58 +0000 (12:56 +0200)
committerSimon Hausmann <simon.hausmann@digia.com>
Tue, 7 May 2013 11:09:56 +0000 (13:09 +0200)
This reflects a bit better how this special value is being used.

Change-Id: I136c8ab648bf82102fb2627e17c574a980c4d5ff
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
15 files changed:
src/qml/qml/qqmlboundsignal.cpp
src/qml/qml/qqmlpropertycache.cpp
src/qml/qml/qqmlvmemetaobject.cpp
src/qml/qml/v4/qv4isel_util_p.h
src/qml/qml/v4/qv4mm.cpp
src/qml/qml/v4/qv4object.cpp
src/qml/qml/v4/qv4object_p.h
src/qml/qml/v4/qv4objectproto.cpp
src/qml/qml/v4/qv4property_p.h
src/qml/qml/v4/qv4runtime.cpp
src/qml/qml/v4/qv4value_p.h
src/qml/qml/v8/qjsvalue_p.h
src/qml/qml/v8/qv8bindings.cpp
src/qml/qml/v8/qv8engine.cpp
src/qml/qml/v8/qv8qobjectwrapper.cpp

index ff61fde..d84d7a4 100644 (file)
@@ -206,7 +206,7 @@ void QQmlBoundSignalExpression::evaluate(void **a)
                                             m_fileName, m_line, &m_v8qmlscope);
             }
 
-            if (m_v8function->isDeleted() || m_v8function->isNull()) {
+            if (m_v8function->isEmpty() || m_v8function->isNull()) {
                 ep->dereferenceScarceResources();
                 return; // could not evaluate function.  Not valid.
             }
index c2ad069..df3d558 100644 (file)
@@ -290,8 +290,8 @@ QQmlPropertyCache::~QQmlPropertyCache()
 
 void QQmlPropertyCache::destroy()
 {
-    Q_ASSERT(engine || constructor->isDeleted());
-    if (constructor->isDeleted())
+    Q_ASSERT(engine || constructor->isEmpty());
+    if (constructor->isEmpty())
         delete this;
     else
         QQmlEnginePrivate::deleteInEngineThread(engine, this);
@@ -598,7 +598,7 @@ void QQmlPropertyCache::append(QQmlEngine *engine, const QMetaObject *metaObject
                                        QQmlPropertyData::Flag signalFlags)
 {
     Q_UNUSED(revision);
-    Q_ASSERT(constructor->isDeleted()); // We should not be appending to an in-use property cache
+    Q_ASSERT(constructor->isEmpty()); // We should not be appending to an in-use property cache
 
     _metaObject = metaObject;
 
index 9121f13..37adaad 100644 (file)
@@ -972,7 +972,7 @@ v8::Handle<v8::Function> QQmlVMEMetaObject::method(int index)
     if (!v8methods) 
         v8methods = new QV4::PersistentValue[metaData->methodCount];
 
-    if (v8methods[index]->isDeleted()) {
+    if (v8methods[index]->isEmpty()) {
         QQmlVMEMetaData::MethodData *data = metaData->methodData() + index;
 
         const char *body = ((const char*)metaData) + data->bodyOffset;
index 54e6464..a696f05 100644 (file)
@@ -51,7 +51,7 @@ inline QV4::Value convertToValue(V4IR::Const *c)
 {
     switch (c->type) {
     case V4IR::MissingType:
-        return QV4::Value::deletedValue();
+        return QV4::Value::emptyValue();
     case V4IR::NullType:
         return QV4::Value::nullValue();
     case V4IR::UndefinedType:
index b400415..9c0e4ad 100644 (file)
@@ -400,7 +400,7 @@ MemoryManager::~MemoryManager()
     PersistentValuePrivate *persistent = m_persistentValues;
     while (persistent) {
         PersistentValuePrivate *n = persistent->next;
-        persistent->value = Value::deletedValue();
+        persistent->value = Value::emptyValue();
         persistent->prev = 0;
         persistent->next = 0;
         persistent = n;
index 19b5146..9a3d15f 100644 (file)
@@ -1136,7 +1136,7 @@ void Object::arrayReserve(uint n)
         arrayData = newArrayData;
         if (sparseArray) {
             for (uint i = arrayFreeList; i < arrayAlloc; ++i) {
-                arrayData[i].value = Value::deletedValue();
+                arrayData[i].value = Value::emptyValue();
                 arrayData[i].value = Value::fromInt32(i + 1);
             }
         } else {
@@ -1193,7 +1193,7 @@ bool Object::setArrayLength(uint newLen) {
                             arrayAttributes[it->value].clear();
                         }
                     }
-                    pd.value.tag = Value::_Deleted_Type;
+                    pd.value.tag = Value::_Empty_Type;
                     pd.value.int_32 = arrayFreeList;
                     arrayFreeList = it->value;
                     bool brk = (it == begin);
@@ -1216,7 +1216,7 @@ bool Object::setArrayLength(uint newLen) {
                     } else {
                         arrayAttributes[it - arrayData].clear();
                     }
-                    it->value = Value::deletedValue();
+                    it->value = Value::emptyValue();
                 }
             }
             arrayDataLen = newLen;
index ac5ca07..e1cf57c 100644 (file)
@@ -197,7 +197,7 @@ struct Q_QML_EXPORT Object: Managed {
     }
     void freeArrayValue(int idx) {
         Property &pd = arrayData[idx];
-        pd.value.tag = Value::_Deleted_Type;
+        pd.value.tag = Value::_Empty_Type;
         pd.value.int_32 = arrayFreeList;
         arrayFreeList = idx;
         if (arrayAttributes)
index f395268..3803d42 100644 (file)
@@ -531,7 +531,7 @@ void ObjectPrototype::toPropertyDescriptor(ExecutionContext *ctx, Value v, Prope
     }
 
     if (attrs->isGeneric())
-        desc->value = Value::deletedValue();
+        desc->value = Value::emptyValue();
 }
 
 
index 2a3c5bf..8598d81 100644 (file)
@@ -89,7 +89,7 @@ struct Property {
 
     static Property genericDescriptor() {
         Property pd;
-        pd.value = Value::deletedValue();
+        pd.value = Value::emptyValue();
         return pd;
     }
 
index d21399a..ae2c0d1 100644 (file)
@@ -1238,7 +1238,7 @@ void __qmljs_builtin_define_array(ExecutionContext *ctx, Value *array, Value *va
         a->arrayDataLen = length;
         Property *pd = a->arrayData;
         for (uint i = 0; i < length; ++i) {
-            if (values[i].isDeleted()) {
+            if (values[i].isEmpty()) {
                 a->ensureArrayAttributes();
                 pd->value = Value::undefinedValue();
                 a->arrayAttributes[i].clear();
index 9e56df0..1d2285c 100644 (file)
@@ -121,7 +121,7 @@ struct Q_QML_EXPORT Value
 
     enum ValueTypeInternal {
         _Undefined_Type = Undefined_Type,
-        _Deleted_Type = Deleted_Type,
+        _Empty_Type = Deleted_Type,
         _Null_Type = Null_Type | ConvertibleToInt,
         _Boolean_Type = Boolean_Type | ConvertibleToInt,
         _Integer_Type = Integer_Type | ConvertibleToInt,
@@ -135,7 +135,7 @@ struct Q_QML_EXPORT Value
     }
 
     // used internally in property
-    inline bool isDeleted() const { return tag == _Deleted_Type; }
+    inline bool isEmpty() const { return tag == _Empty_Type; }
 
     inline bool isUndefined() const { return tag == _Undefined_Type; }
     inline bool isNull() const { return tag == _Null_Type; }
@@ -196,7 +196,7 @@ struct Q_QML_EXPORT Value
         return val;
     }
 
-    static Value deletedValue();
+    static Value emptyValue();
     static Value undefinedValue();
     static Value nullValue();
     static Value fromBoolean(Bool b);
@@ -313,10 +313,10 @@ inline Value Value::nullValue()
     return v;
 }
 
-inline Value Value::deletedValue()
+inline Value Value::emptyValue()
 {
     Value v;
-    v.tag = Value::_Deleted_Type;
+    v.tag = Value::_Empty_Type;
     v.uint_32 = 0;
     return v;
 }
@@ -552,7 +552,7 @@ inline Value Managed::call(ExecutionContext *context, const Value &thisObject, V
 struct PersistentValuePrivate
 {
     PersistentValuePrivate()
-        : value(Value::deletedValue())
+        : value(Value::emptyValue())
         , refcount(1)
         , prev(0)
         , next(0)
index 441ab1a..ab8572b 100644 (file)
@@ -70,7 +70,7 @@ public:
     QJSValuePrivate(const QV4::Value &v)
         : PersistentValuePrivate(v)
     {
-        if (value.isDeleted())
+        if (value.isEmpty())
             value = QV4::Value::undefinedValue();
     }
     QJSValuePrivate(QV4::Object *o)
index ebd3451..a17f2a7 100644 (file)
@@ -245,7 +245,7 @@ QV8Bindings::QV8Bindings(QQmlCompiledData::V8Program *program,
 {
     QV8Engine *engine = QQmlEnginePrivate::getV8Engine(context->engine);
 
-    if (program->bindings->isDeleted()) {
+    if (program->bindings->isEmpty()) {
         v8::Handle<v8::Script> script;
         bool compileFailed = false;
         {
index 6b6fe7b..a70b04d 100644 (file)
@@ -192,7 +192,7 @@ QV8Engine::~QV8Engine()
 
 QVariant QV8Engine::toVariant(const QV4::Value &value, int typeHint)
 {
-    if (value.isDeleted())
+    if (value.isEmpty())
         return QVariant();
 
     if (typeHint == QVariant::Bool)
@@ -1255,7 +1255,7 @@ QV4::Value QV8Engine::variantToJS(const QVariant &value)
 QVariant QV8Engine::variantFromJS(const QV4::Value &value,
                                   V8ObjectSet &visitedObjects)
 {
-    Q_ASSERT(!value.isDeleted());
+    Q_ASSERT(!value.isEmpty());
     if (value.isUndefined())
         return QVariant();
     if (value.isNull())
index aa22156..e25b8b4 100644 (file)
@@ -961,7 +961,7 @@ v8::Handle<v8::Object> QQmlPropertyCache::newQObject(QObject *object, QV8Engine
     Q_ASSERT(QQmlData::get(object, false)->propertyCache == this);
 
     // Setup constructor
-    if (constructor->isDeleted()) {
+    if (constructor->isEmpty()) {
         v8::Handle<v8::FunctionTemplate> ft;
 
         const QHashedString toString(QStringLiteral("toString"));