aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2013-09-17 18:16:35 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-09-22 01:06:20 +0200
commit21198a676128a52e892557bc434035bcd1ddfaac (patch)
tree10b165b797a7723507b8da375444549a5420e1e8 /src/qml
parente441692b0b8f8fffdfdfa8a21c570adcd5cbae7a (diff)
Don't use Value::emptyValue() anymore.
emptyValue is special and reserved for usage inside the engine to mark missing values. The main to use cases are when converting property descriptors, and to mark holes in array data. Change-Id: I0ed357e65102b1041bf9a878e6e9a4ae0657523b Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'src/qml')
-rw-r--r--src/qml/jsapi/qjsvalue.cpp2
-rw-r--r--src/qml/jsapi/qjsvalue_p.h3
-rw-r--r--src/qml/jsruntime/qv4qobjectwrapper.cpp26
-rw-r--r--src/qml/jsruntime/qv4runtime.cpp6
-rw-r--r--src/qml/jsruntime/qv4script.cpp2
-rw-r--r--src/qml/jsruntime/qv4serialize.cpp1
-rw-r--r--src/qml/jsruntime/qv4value.cpp6
-rw-r--r--src/qml/jsruntime/qv4value_p.h10
-rw-r--r--src/qml/jsruntime/qv4variantobject.cpp2
-rw-r--r--src/qml/qml/qqmlboundsignal.cpp2
-rw-r--r--src/qml/qml/qqmlcomponent.cpp12
-rw-r--r--src/qml/qml/qqmljavascriptexpression.cpp6
-rw-r--r--src/qml/qml/qqmlvmemetaobject.cpp10
-rw-r--r--src/qml/qml/qqmlxmlhttprequest.cpp16
-rw-r--r--src/qml/qml/v8/qv8engine.cpp3
-rw-r--r--src/qml/types/qqmldelegatemodel.cpp2
-rw-r--r--src/qml/types/qqmllistmodel.cpp6
-rw-r--r--src/qml/util/qqmladaptormodel.cpp2
18 files changed, 61 insertions, 56 deletions
diff --git a/src/qml/jsapi/qjsvalue.cpp b/src/qml/jsapi/qjsvalue.cpp
index 908e9a4519..6b3d15df59 100644
--- a/src/qml/jsapi/qjsvalue.cpp
+++ b/src/qml/jsapi/qjsvalue.cpp
@@ -63,7 +63,7 @@ QV4::ReturnedValue QJSValuePrivate::getValue(QV4::ExecutionEngine *e)
this->engine = e;
else if (this->engine != e) {
qWarning("JSValue can't be reassigned to another engine.");
- return QV4::Value::emptyValue().asReturnedValue();
+ return QV4::Encode::undefined();
}
if (value.asString() == &string) {
value = QV4::Value::fromString(engine->newString(string.toQString()));
diff --git a/src/qml/jsapi/qjsvalue_p.h b/src/qml/jsapi/qjsvalue_p.h
index f99fed7c44..a0dfa010ab 100644
--- a/src/qml/jsapi/qjsvalue_p.h
+++ b/src/qml/jsapi/qjsvalue_p.h
@@ -72,8 +72,7 @@ public:
QJSValuePrivate(QV4::ExecutionEngine *engine, const QV4::Value &v)
: PersistentValuePrivate(v, engine)
{
- if (value.isEmpty())
- value = QV4::Value::undefinedValue();
+ Q_ASSERT(!value.isEmpty());
}
QJSValuePrivate(QV4::Object *o)
: PersistentValuePrivate(QV4::Value::fromObject(o))
diff --git a/src/qml/jsruntime/qv4qobjectwrapper.cpp b/src/qml/jsruntime/qv4qobjectwrapper.cpp
index d774014073..a779a41293 100644
--- a/src/qml/jsruntime/qv4qobjectwrapper.cpp
+++ b/src/qml/jsruntime/qv4qobjectwrapper.cpp
@@ -544,10 +544,10 @@ ReturnedValue QObjectWrapper::wrap(ExecutionEngine *engine, QObject *object)
Scope scope(engine);
- if (ddata->jsEngineId == engine->m_engineId && !ddata->jsWrapper.isEmpty()) {
+ if (ddata->jsEngineId == engine->m_engineId && !ddata->jsWrapper.isUndefined()) {
// We own the JS object
return ddata->jsWrapper.value().asReturnedValue();
- } else if (ddata->jsWrapper.isEmpty() &&
+ } else if (ddata->jsWrapper.isUndefined() &&
(ddata->jsEngineId == engine->m_engineId || // We own the QObject
ddata->jsEngineId == 0 || // No one owns the QObject
!ddata->hasTaintedV8Object)) { // Someone else has used the QObject, but it isn't tainted
@@ -566,7 +566,7 @@ ReturnedValue QObjectWrapper::wrap(ExecutionEngine *engine, QObject *object)
// If our tainted handle doesn't exist or has been collected, and there isn't
// a handle in the ddata, we can assume ownership of the ddata->v8object
- if (ddata->jsWrapper.isEmpty() && !alternateWrapper) {
+ if (ddata->jsWrapper.isUndefined() && !alternateWrapper) {
QV4::ScopedValue result(scope, create(engine, ddata, object));
ddata->jsWrapper = result;
ddata->jsEngineId = engine->m_engineId;
@@ -698,7 +698,7 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
Scope scope(v4);
QV4::ScopedCallData callData(scope, argCount);
- callData->thisObject = This->thisObject.isEmpty() ? Value::fromObject(v4->globalObject) : This->thisObject.value();
+ callData->thisObject = This->thisObject.isUndefined() ? Value::fromObject(v4->globalObject) : This->thisObject.value();
for (int ii = 0; ii < argCount; ++ii) {
int type = argsTypes[ii + 1];
if (type == qMetaTypeId<QVariant>()) {
@@ -722,7 +722,7 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
break;
case Compare: {
QObjectSlotDispatcher *connection = static_cast<QObjectSlotDispatcher*>(this_);
- if (connection->function.isEmpty()) {
+ if (connection->function.isUndefined()) {
*ret = false;
return;
}
@@ -744,8 +744,8 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
if (slotIndexToDisconnect != -1) {
// This is a QObject function wrapper
- if (connection->thisObject.isEmpty() == thisObject->isEmpty() &&
- (connection->thisObject.isEmpty() || __qmljs_strict_equal(connection->thisObject, thisObject))) {
+ if (connection->thisObject.isUndefined() == thisObject->isUndefined() &&
+ (connection->thisObject.isUndefined() || __qmljs_strict_equal(connection->thisObject, thisObject))) {
QPair<QObject *, int> connectedFunctionData = extractQtMethod(connection->function.value().asFunctionObject());
if (connectedFunctionData.first == receiverToDisconnect &&
@@ -757,8 +757,8 @@ struct QObjectSlotDispatcher : public QtPrivate::QSlotObjectBase
} else {
// This is a normal JS function
if (__qmljs_strict_equal(connection->function, function) &&
- connection->thisObject.isEmpty() == thisObject->isEmpty() &&
- (connection->thisObject.isEmpty() || __qmljs_strict_equal(connection->thisObject, thisObject))) {
+ connection->thisObject.isUndefined() == thisObject->isUndefined() &&
+ (connection->thisObject.isUndefined() || __qmljs_strict_equal(connection->thisObject, thisObject))) {
*ret = true;
return;
}
@@ -806,7 +806,7 @@ ReturnedValue QObjectWrapper::method_connect(SimpleCallContext *ctx)
if (!slot->function.value().asFunctionObject())
V4THROW_ERROR("Function.prototype.connect: target is not a function");
- if (!slot->thisObject.isEmpty() && !slot->thisObject.value().isObject())
+ if (!slot->thisObject.isUndefined() && !slot->thisObject.value().isObject())
V4THROW_ERROR("Function.prototype.connect: target this is not an object");
QObjectPrivate::connect(signalObject, signalIndex, slot, Qt::AutoConnection);
@@ -832,8 +832,8 @@ ReturnedValue QObjectWrapper::method_disconnect(SimpleCallContext *ctx)
if (signalIndex < 0 || signalObject->metaObject()->method(signalIndex).methodType() != QMetaMethod::Signal)
V4THROW_ERROR("Function.prototype.disconnect: this object is not a signal");
- QV4::Value functionValue = QV4::Value::emptyValue();
- QV4::Value functionThisValue = QV4::Value::emptyValue();
+ QV4::Value functionValue = QV4::Value::undefinedValue();
+ QV4::Value functionThisValue = QV4::Value::undefinedValue();
if (ctx->argumentCount == 1) {
functionValue = ctx->arguments[0];
@@ -845,7 +845,7 @@ ReturnedValue QObjectWrapper::method_disconnect(SimpleCallContext *ctx)
if (!functionValue.asFunctionObject())
V4THROW_ERROR("Function.prototype.disconnect: target is not a function");
- if (!functionThisValue.isEmpty() && !functionThisValue.isObject())
+ if (!functionThisValue.isUndefined() && !functionThisValue.isObject())
V4THROW_ERROR("Function.prototype.disconnect: target this is not an object");
QPair<QObject *, int> functionData = extractQtMethod(functionValue.asFunctionObject());
diff --git a/src/qml/jsruntime/qv4runtime.cpp b/src/qml/jsruntime/qv4runtime.cpp
index 446ea9df3a..f440ade430 100644
--- a/src/qml/jsruntime/qv4runtime.cpp
+++ b/src/qml/jsruntime/qv4runtime.cpp
@@ -616,8 +616,9 @@ Returned<Object> *__qmljs_convert_to_object(ExecutionContext *ctx, const ValueRe
Returned<String> *__qmljs_convert_to_string(ExecutionContext *ctx, const ValueRef value)
{
switch (value->type()) {
- case Value::Undefined_Type:
case Value::Empty_Type:
+ Q_ASSERT(!"empty Value encountered");
+ case Value::Undefined_Type:
return ctx->engine->id_undefined->asReturned<String>();
case Value::Null_Type:
return ctx->engine->id_null->asReturned<String>();
@@ -970,7 +971,8 @@ ReturnedValue __qmljs_call_property(ExecutionContext *context, String *name, Cal
Scope scope(context);
Scoped<Object> baseObject(scope, callData->thisObject);
if (!baseObject) {
- if (callData->thisObject.isNullOrUndefined() || callData->thisObject.isEmpty()) {
+ Q_ASSERT(!callData->thisObject.isEmpty());
+ if (callData->thisObject.isNullOrUndefined()) {
QString message = QStringLiteral("Cannot call method '%1' of %2").arg(name->toQString()).arg(callData->thisObject.toQStringNoThrow());
context->throwTypeError(message);
}
diff --git a/src/qml/jsruntime/qv4script.cpp b/src/qml/jsruntime/qv4script.cpp
index 7dd3bbeb66..fe61168d3c 100644
--- a/src/qml/jsruntime/qv4script.cpp
+++ b/src/qml/jsruntime/qv4script.cpp
@@ -221,7 +221,7 @@ ReturnedValue Script::run()
QV4::ExecutionEngine *engine = scope->engine;
QV4::Scope valueScope(engine);
- if (qml.isEmpty()) {
+ if (qml.isUndefined()) {
TemporaryAssignment<Function*> savedGlobalCode(engine->globalCode, vmFunction);
bool strict = scope->strictMode;
diff --git a/src/qml/jsruntime/qv4serialize.cpp b/src/qml/jsruntime/qv4serialize.cpp
index 35022acfd5..390c3382f2 100644
--- a/src/qml/jsruntime/qv4serialize.cpp
+++ b/src/qml/jsruntime/qv4serialize.cpp
@@ -153,6 +153,7 @@ void Serialize::serialize(QByteArray &data, const QV4::Value &v, QV8Engine *engi
QV4::Scope scope(v4);
if (v.isEmpty()) {
+ Q_ASSERT(!"Serialize: got empty value");
} else if (v.isUndefined()) {
push(data, valueheader(WorkerUndefined));
} else if (v.isNull()) {
diff --git a/src/qml/jsruntime/qv4value.cpp b/src/qml/jsruntime/qv4value.cpp
index 570ba9e82e..197b1c2ee5 100644
--- a/src/qml/jsruntime/qv4value.cpp
+++ b/src/qml/jsruntime/qv4value.cpp
@@ -107,8 +107,9 @@ double Value::toNumberImpl() const
QString Value::toQStringNoThrow() const
{
switch (type()) {
- case Value::Undefined_Type:
case Value::Empty_Type:
+ Q_ASSERT(!"empty Value encountered");
+ case Value::Undefined_Type:
return QStringLiteral("undefined");
case Value::Null_Type:
return QStringLiteral("null");
@@ -156,8 +157,9 @@ QString Value::toQStringNoThrow() const
QString Value::toQString() const
{
switch (type()) {
- case Value::Undefined_Type:
case Value::Empty_Type:
+ Q_ASSERT(!"empty Value encountered");
+ case Value::Undefined_Type:
return QStringLiteral("undefined");
case Value::Null_Type:
return QStringLiteral("null");
diff --git a/src/qml/jsruntime/qv4value_p.h b/src/qml/jsruntime/qv4value_p.h
index 6cefe13ae6..bfad395b3b 100644
--- a/src/qml/jsruntime/qv4value_p.h
+++ b/src/qml/jsruntime/qv4value_p.h
@@ -391,7 +391,7 @@ public:
~PersistentValue();
Value value() const {
- return d ? d->value : Value::emptyValue();
+ return d ? d->value : Value::undefinedValue();
}
ExecutionEngine *engine() {
@@ -403,7 +403,8 @@ public:
operator Value() const { return value(); }
- bool isEmpty() const { return !d || d->value.isEmpty(); }
+ bool isUndefined() const { return !d || d->value.isUndefined(); }
+ bool isNullOrUndefined() const { return !d || d->value.isNullOrUndefined(); }
void clear() {
*this = PersistentValue();
}
@@ -431,7 +432,7 @@ public:
~WeakValue();
Value value() const {
- return d ? d->value : Value::emptyValue();
+ return d ? d->value : Value::undefinedValue();
}
ExecutionEngine *engine() {
@@ -443,7 +444,8 @@ public:
operator Value() const { return value(); }
- bool isEmpty() const { return !d || d->value.isEmpty(); }
+ bool isUndefined() const { return !d || d->value.isUndefined(); }
+ bool isNullOrUndefined() const { return !d || d->value.isNullOrUndefined(); }
void clear() {
*this = WeakValue();
}
diff --git a/src/qml/jsruntime/qv4variantobject.cpp b/src/qml/jsruntime/qv4variantobject.cpp
index ed3342aa58..cea946b66b 100644
--- a/src/qml/jsruntime/qv4variantobject.cpp
+++ b/src/qml/jsruntime/qv4variantobject.cpp
@@ -86,7 +86,7 @@ QVariant VariantObject::toVariant(const QV4::Value &v)
}
if (v.isNull())
return QVariant(QMetaType::VoidStar, 0);
- assert (v.isUndefined() || v.isEmpty());
+ Q_ASSERT(v.isUndefined());
return QVariant();
}
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp
index 36cbc39d40..3a0d58d87c 100644
--- a/src/qml/qml/qqmlboundsignal.cpp
+++ b/src/qml/qml/qqmlboundsignal.cpp
@@ -181,7 +181,7 @@ void QQmlBoundSignalExpression::evaluate(void **a)
m_v8function = evalFunction(context(), scopeObject(), expression,
m_fileName, m_line, &m_v8qmlscope);
- if (m_v8function.isEmpty() || m_v8function.value().isNull()) {
+ if (m_v8function.isUndefined() || m_v8function.value().isNull()) {
ep->dereferenceScarceResources();
return; // could not evaluate function. Not valid.
}
diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp
index 149cbf2c49..623efb54b2 100644
--- a/src/qml/qml/qqmlcomponent.cpp
+++ b/src/qml/qml/qqmlcomponent.cpp
@@ -1206,7 +1206,7 @@ void QQmlComponent::createObject(QQmlV4Function *args)
Q_ASSERT(args);
QObject *parent = 0;
- QV4::Value valuemap = QV4::Value::emptyValue();
+ QV4::Value valuemap = QV4::Value::undefinedValue();
if (args->length() >= 1) {
if (QV4::QObjectWrapper *qobjectWrapper = (*args)[0].as<QV4::QObjectWrapper>())
@@ -1242,7 +1242,7 @@ void QQmlComponent::createObject(QQmlV4Function *args)
QV4::ScopedValue object(scope, QV4::QObjectWrapper::wrap(v4engine, rv));
Q_ASSERT(object->isObject());
- if (!valuemap.isEmpty()) {
+ if (!valuemap.isUndefined()) {
QQmlComponentExtension *e = componentExtension(v8engine);
QV4::Scoped<QV4::FunctionObject> f(scope, QV4::Script::evaluate(v4engine, QString::fromLatin1(INITIALPROPERTIES_SOURCE), args->qmlGlobal().asObject()));
QV4::ScopedCallData callData(scope, 2);
@@ -1330,7 +1330,7 @@ void QQmlComponent::incubateObject(QQmlV4Function *args)
Q_ASSERT(args);
QObject *parent = 0;
- QV4::Value valuemap = QV4::Value::emptyValue();
+ QV4::Value valuemap = QV4::Value::undefinedValue();
QQmlIncubator::IncubationMode mode = QQmlIncubator::Asynchronous;
if (args->length() >= 1) {
@@ -1364,7 +1364,7 @@ void QQmlComponent::incubateObject(QQmlV4Function *args)
QmlIncubatorObject *r = new (v4->memoryManager) QmlIncubatorObject(args->engine(), mode);
r->setPrototype(e->incubationProto.value().asObject());
- if (!valuemap.isEmpty()) {
+ if (!valuemap.isUndefined()) {
r->valuemap = valuemap;
r->qmlGlobal = args->qmlGlobal();
}
@@ -1390,7 +1390,7 @@ void QQmlComponentPrivate::initializeObjectWithInitialProperties(const QV4::Valu
QV4::ScopedValue object(scope, QV4::QObjectWrapper::wrap(v4engine, toCreate));
Q_ASSERT(object->asObject());
- if (!valuemap.isEmpty()) {
+ if (!valuemap.isUndefined()) {
QQmlComponentExtension *e = componentExtension(v8engine);
QV4::Scoped<QV4::FunctionObject> f(scope, QV4::Script::evaluate(QV8Engine::getV4(v8engine),
QString::fromLatin1(INITIALPROPERTIES_SOURCE), qmlGlobal.asObject()));
@@ -1492,7 +1492,7 @@ void QmlIncubatorObject::setInitialState(QObject *o)
{
QQmlComponent_setQmlParent(o, parent);
- if (!valuemap.isEmpty()) {
+ if (!valuemap.isUndefined()) {
QQmlComponentExtension *e = componentExtension(v8);
QV4::ExecutionEngine *v4 = QV8Engine::getV4(v8);
diff --git a/src/qml/qml/qqmljavascriptexpression.cpp b/src/qml/qml/qqmljavascriptexpression.cpp
index d16d421ed2..5c3e61759a 100644
--- a/src/qml/qml/qqmljavascriptexpression.cpp
+++ b/src/qml/qml/qqmljavascriptexpression.cpp
@@ -135,10 +135,10 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QQmlContextData *context,
{
Q_ASSERT(context && context->engine);
- if (function.isEmpty() || function.isUndefined()) {
+ if (function.isUndefined()) {
if (isUndefined)
*isUndefined = true;
- return QV4::Value::emptyValue().asReturnedValue();
+ return QV4::Value::undefinedValue().asReturnedValue();
}
QQmlEnginePrivate *ep = QQmlEnginePrivate::get(context->engine);
@@ -187,7 +187,7 @@ QV4::ReturnedValue QQmlJavaScriptExpression::evaluate(QQmlContextData *context,
if (isUndefined)
*isUndefined = true;
if (!watcher.wasDeleted()) {
- if (!ex->isEmpty()) {
+ if (!ex->isUndefined()) {
delayedError()->setError(e);
} else {
if (hasDelayedError())
diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp
index 6739143979..e3a6621ab4 100644
--- a/src/qml/qml/qqmlvmemetaobject.cpp
+++ b/src/qml/qml/qqmlvmemetaobject.cpp
@@ -71,7 +71,7 @@ QQmlVMEVariantQObjectPtr::~QQmlVMEVariantQObjectPtr()
void QQmlVMEVariantQObjectPtr::objectDestroyed(QObject *)
{
if (m_target && m_index >= 0) {
- if (m_isVar && m_target->varPropertiesInitialized && !m_target->varProperties.isEmpty()) {
+ if (m_isVar && m_target->varPropertiesInitialized && !m_target->varProperties.isUndefined()) {
// Set the var property to NULL
QV4::ArrayObject *a = m_target->varProperties.value().asArrayObject();
if (a)
@@ -966,13 +966,13 @@ QV4::ReturnedValue QQmlVMEMetaObject::method(int index)
{
if (!ctxt || !ctxt->isValid()) {
qWarning("QQmlVMEMetaObject: Internal error - attempted to evaluate a function in an invalid context");
- return QV4::Value::emptyValue().asReturnedValue();
+ return QV4::Value::undefinedValue().asReturnedValue();
}
if (!v8methods)
v8methods = new QV4::PersistentValue[metaData->methodCount];
- if (v8methods[index].isEmpty()) {
+ if (v8methods[index].isUndefined()) {
QQmlVMEMetaData::MethodData *data = metaData->methodData() + index;
const char *body = ((const char*)metaData) + data->bodyOffset;
@@ -994,7 +994,7 @@ QV4::ReturnedValue QQmlVMEMetaObject::readVarProperty(int id)
if (ensureVarPropertiesAllocated())
return varProperties.value().asObject()->getIndexed(id - firstVarPropertyIndex);
- return QV4::Value::emptyValue().asReturnedValue();
+ return QV4::Value::undefinedValue().asReturnedValue();
}
QVariant QQmlVMEMetaObject::readPropertyAsVariant(int id)
@@ -1208,7 +1208,7 @@ bool QQmlVMEMetaObject::ensureVarPropertiesAllocated()
// QObject ptr will not yet have been deleted (eg, waiting on deleteLater).
// In this situation, the varProperties handle will be (and should remain)
// empty.
- return !varProperties.isEmpty();
+ return !varProperties.isUndefined();
}
void QQmlVMEMetaObject::ensureQObjectWrapper()
diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp
index bef943fd51..131fb1c51f 100644
--- a/src/qml/qml/qqmlxmlhttprequest.cpp
+++ b/src/qml/qml/qqmlxmlhttprequest.cpp
@@ -580,7 +580,7 @@ ReturnedValue NodePrototype::method_get_attributes(SimpleCallContext *ctx)
Value NodePrototype::getProto(ExecutionEngine *v4)
{
QQmlXMLHttpRequestData *d = xhrdata(v4->v8Engine);
- if (d->nodePrototype.isEmpty()) {
+ if (d->nodePrototype.isUndefined()) {
Object *p = new (v4->memoryManager) NodePrototype(v4);
d->nodePrototype = Value::fromObject(p);
v4->v8Engine->freezeObject(d->nodePrototype.value());
@@ -625,7 +625,7 @@ Value Node::create(QV8Engine *engine, NodeImpl *data)
Value Element::prototype(ExecutionEngine *engine)
{
QQmlXMLHttpRequestData *d = xhrdata(engine->v8Engine);
- if (d->elementPrototype.isEmpty()) {
+ if (d->elementPrototype.isUndefined()) {
Scope scope(engine);
Scoped<Object> p(scope, engine->newObject());
p->setPrototype(NodePrototype::getProto(engine).asObject());
@@ -639,7 +639,7 @@ Value Element::prototype(ExecutionEngine *engine)
Value Attr::prototype(ExecutionEngine *engine)
{
QQmlXMLHttpRequestData *d = xhrdata(engine->v8Engine);
- if (d->attrPrototype.isEmpty()) {
+ if (d->attrPrototype.isUndefined()) {
Scope scope(engine);
Scoped<Object> p(scope, engine->newObject());
p->setPrototype(NodePrototype::getProto(engine).asObject());
@@ -695,7 +695,7 @@ ReturnedValue CharacterData::method_length(SimpleCallContext *ctx)
Value CharacterData::prototype(ExecutionEngine *v4)
{
QQmlXMLHttpRequestData *d = xhrdata(v4->v8Engine);
- if (d->characterDataPrototype.isEmpty()) {
+ if (d->characterDataPrototype.isUndefined()) {
Scope scope(v4);
Scoped<Object> p(scope, v4->newObject());
p->setPrototype(NodePrototype::getProto(v4).asObject());
@@ -728,7 +728,7 @@ ReturnedValue Text::method_wholeText(SimpleCallContext *ctx)
Value Text::prototype(ExecutionEngine *v4)
{
QQmlXMLHttpRequestData *d = xhrdata(v4->v8Engine);
- if (d->textPrototype.isEmpty()) {
+ if (d->textPrototype.isUndefined()) {
Scope scope(v4);
Scoped<Object> p(scope, v4->newObject());
p->setPrototype(CharacterData::prototype(v4).asObject());
@@ -744,7 +744,7 @@ Value CDATA::prototype(ExecutionEngine *v4)
{
// ### why not just use TextProto???
QQmlXMLHttpRequestData *d = xhrdata(v4->v8Engine);
- if (d->cdataPrototype.isEmpty()) {
+ if (d->cdataPrototype.isUndefined()) {
Scope scope(v4);
Scoped<Object> p(scope, v4->newObject());
p->setPrototype(Text::prototype(v4).asObject());
@@ -757,7 +757,7 @@ Value CDATA::prototype(ExecutionEngine *v4)
Value Document::prototype(ExecutionEngine *v4)
{
QQmlXMLHttpRequestData *d = xhrdata(v4->v8Engine);
- if (d->documentPrototype.isEmpty()) {
+ if (d->documentPrototype.isUndefined()) {
Scope scope(v4);
Scoped<Object> p(scope, v4->newObject());
p->setPrototype(NodePrototype::getProto(v4).asObject());
@@ -1419,7 +1419,7 @@ void QQmlXMLHttpRequest::finished()
dispatchCallback(m_me);
Scope scope(v4);
- ScopedValue v(scope, Value::emptyValue());
+ ScopedValue v(scope, Value::undefinedValue());
setMe(v);
}
diff --git a/src/qml/qml/v8/qv8engine.cpp b/src/qml/qml/v8/qv8engine.cpp
index b62d8c173d..73ad2807b5 100644
--- a/src/qml/qml/v8/qv8engine.cpp
+++ b/src/qml/qml/v8/qv8engine.cpp
@@ -119,8 +119,7 @@ QV8Engine::~QV8Engine()
QVariant QV8Engine::toVariant(const QV4::Value &value, int typeHint)
{
- if (value.isEmpty())
- return QVariant();
+ Q_ASSERT (!value.isEmpty());
if (QV4::VariantObject *v = value.as<QV4::VariantObject>())
return v->data;
diff --git a/src/qml/types/qqmldelegatemodel.cpp b/src/qml/types/qqmldelegatemodel.cpp
index b9f78da96e..c0b0b59f1d 100644
--- a/src/qml/types/qqmldelegatemodel.cpp
+++ b/src/qml/types/qqmldelegatemodel.cpp
@@ -2383,7 +2383,7 @@ QQmlV4Handle QQmlDelegateModelGroup::get(int index)
model->m_compositor.setFlags(it, 1, Compositor::CacheFlag);
}
- if (model->m_cacheMetaType->modelItemProto.isEmpty())
+ if (model->m_cacheMetaType->modelItemProto.isUndefined())
model->m_cacheMetaType->initializePrototype();
QV8Engine *v8 = model->m_cacheMetaType->v8Engine;
QV4::ExecutionEngine *v4 = QV8Engine::getV4(v8);
diff --git a/src/qml/types/qqmllistmodel.cpp b/src/qml/types/qqmllistmodel.cpp
index 20d1211716..4ce5047c8f 100644
--- a/src/qml/types/qqmllistmodel.cpp
+++ b/src/qml/types/qqmllistmodel.cpp
@@ -464,7 +464,7 @@ void ListModel::set(int elementIndex, QV4::Object *object, QVector<int> *roles,
if (role.type == ListLayout::Role::VariantMap)
roleIndex = e->setVariantMapProperty(role, o, eng);
}
- } else if (propertyValue.isEmpty() || propertyValue.isUndefined() || propertyValue.isNull()) {
+ } else if (propertyValue.isUndefined() || propertyValue.isNull()) {
const ListLayout::Role *r = m_layout->getExistingRole(propertyName.getPointer());
if (r)
e->clearProperty(*r);
@@ -540,7 +540,7 @@ void ListModel::set(int elementIndex, QV4::Object *object, QV8Engine *eng)
if (role.type == ListLayout::Role::VariantMap)
e->setVariantMapFast(role, o, eng);
}
- } else if (propertyValue.isEmpty() || propertyValue.isUndefined() || propertyValue.isNull()) {
+ } else if (propertyValue.isUndefined() || propertyValue.isNull()) {
const ListLayout::Role *r = m_layout->getExistingRole(propertyName.getPointer());
if (r)
e->clearProperty(*r);
@@ -1198,7 +1198,7 @@ int ListElement::setJsProperty(const ListLayout::Role &role, const QV4::Value &d
} else if (role.type == ListLayout::Role::VariantMap) {
roleIndex = setVariantMapProperty(role, o, eng);
}
- } else if (d.isEmpty() || d.isUndefined() || d.isNull()) {
+ } else if (d.isUndefined() || d.isNull()) {
clearProperty(role);
}
diff --git a/src/qml/util/qqmladaptormodel.cpp b/src/qml/util/qqmladaptormodel.cpp
index add422b8da..6c12d7310f 100644
--- a/src/qml/util/qqmladaptormodel.cpp
+++ b/src/qml/util/qqmladaptormodel.cpp
@@ -425,7 +425,7 @@ public:
QV4::ReturnedValue get()
{
- if (type->prototype.isEmpty()) {
+ if (type->prototype.isUndefined()) {
QQmlAdaptorModelEngineData * const data = engineData(v4->v8Engine);
type->initializeConstructor(data);
}