diff options
author | Lars Knoll <lars.knoll@qt.io> | 2018-09-11 11:07:32 +0200 |
---|---|---|
committer | Lars Knoll <lars.knoll@qt.io> | 2018-09-17 07:47:09 +0000 |
commit | 1dac47c1418b44cf4a56b42bfca2b277795fd213 (patch) | |
tree | 26727943c30628340662a66d7cbe9f52d75c5b58 /src/qml/qml | |
parent | d89d5cffe79bd060a1b04a2c47a3d728bffbe195 (diff) |
Cleanups in Value/Primitive
Get rid of Primitive and move the corresponding methods
directly into Value. Mark many methods in Value as
constexpr and turn Value into a POD type again.
Keep Primitive as a pure alias to Value for source
compatibility of other modules that might be using it.
Change-Id: Icb47458947dd3482c8852e95782123ea4346f5ec
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/qml/qml')
-rw-r--r-- | src/qml/qml/qqmlboundsignal.cpp | 4 | ||||
-rw-r--r-- | src/qml/qml/qqmlcomponent.cpp | 10 | ||||
-rw-r--r-- | src/qml/qml/qqmllistwrapper.cpp | 4 | ||||
-rw-r--r-- | src/qml/qml/qqmllocale.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlobjectcreator.cpp | 6 | ||||
-rw-r--r-- | src/qml/qml/qqmltypewrapper.cpp | 6 | ||||
-rw-r--r-- | src/qml/qml/qqmlvaluetypewrapper.cpp | 2 | ||||
-rw-r--r-- | src/qml/qml/qqmlvmemetaobject.cpp | 12 | ||||
-rw-r--r-- | src/qml/qml/qqmlxmlhttprequest.cpp | 24 | ||||
-rw-r--r-- | src/qml/qml/v8/qqmlbuiltinfunctions.cpp | 10 | ||||
-rw-r--r-- | src/qml/qml/v8/qv4domerrors.cpp | 34 | ||||
-rw-r--r-- | src/qml/qml/v8/qv4domerrors_p.h | 2 | ||||
-rw-r--r-- | src/qml/qml/v8/qv4sqlerrors.cpp | 16 |
13 files changed, 66 insertions, 66 deletions
diff --git a/src/qml/qml/qqmlboundsignal.cpp b/src/qml/qml/qqmlboundsignal.cpp index 82c7921e0c..e5b78591e0 100644 --- a/src/qml/qml/qqmlboundsignal.cpp +++ b/src/qml/qml/qqmlboundsignal.cpp @@ -209,12 +209,12 @@ void QQmlBoundSignalExpression::evaluate(void **a) jsCall->args[ii] = scope.engine->fromVariant(*((QVariant *)a[ii + 1])); } else if (type == QMetaType::Int) { //### optimization. Can go away if we switch to metaTypeToJS, or be expanded otherwise - jsCall->args[ii] = QV4::Primitive::fromInt32(*reinterpret_cast<const int*>(a[ii + 1])); + jsCall->args[ii] = QV4::Value::fromInt32(*reinterpret_cast<const int*>(a[ii + 1])); } else if (type == qMetaTypeId<QQmlV4Handle>()) { jsCall->args[ii] = *reinterpret_cast<QQmlV4Handle *>(a[ii + 1]); } else if (ep->isQObject(type)) { if (!*reinterpret_cast<void* const *>(a[ii + 1])) - jsCall->args[ii] = QV4::Primitive::nullValue(); + jsCall->args[ii] = QV4::Value::nullValue(); else jsCall->args[ii] = QV4::QObjectWrapper::wrap(v4, *reinterpret_cast<QObject* const *>(a[ii + 1])); } else { diff --git a/src/qml/qml/qqmlcomponent.cpp b/src/qml/qml/qqmlcomponent.cpp index 45b0f18530..6dc8dd0ce7 100644 --- a/src/qml/qml/qqmlcomponent.cpp +++ b/src/qml/qml/qqmlcomponent.cpp @@ -1271,7 +1271,7 @@ void QQmlComponent::createObject(QQmlV4Function *args) QObject *parent = nullptr; QV4::ExecutionEngine *v4 = args->v4engine(); QV4::Scope scope(v4); - QV4::ScopedValue valuemap(scope, QV4::Primitive::undefinedValue()); + QV4::ScopedValue valuemap(scope, QV4::Value::undefinedValue()); if (args->length() >= 1) { QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, (*args)[0]); @@ -1386,7 +1386,7 @@ void QQmlComponent::incubateObject(QQmlV4Function *args) QV4::Scope scope(v4); QObject *parent = nullptr; - QV4::ScopedValue valuemap(scope, QV4::Primitive::undefinedValue()); + QV4::ScopedValue valuemap(scope, QV4::Value::undefinedValue()); QQmlIncubator::IncubationMode mode = QQmlIncubator::Asynchronous; if (args->length() >= 1) { @@ -1524,8 +1524,8 @@ QQmlComponentExtension::~QQmlComponentExtension() void QV4::Heap::QmlIncubatorObject::init(QQmlIncubator::IncubationMode m) { Object::init(); - valuemap.set(internalClass->engine, QV4::Primitive::undefinedValue()); - statusChanged.set(internalClass->engine, QV4::Primitive::undefinedValue()); + valuemap.set(internalClass->engine, QV4::Value::undefinedValue()); + statusChanged.set(internalClass->engine, QV4::Value::undefinedValue()); parent.init(); qmlContext.set(internalClass->engine, nullptr); incubator = new QQmlComponentIncubator(this, m); @@ -1566,7 +1566,7 @@ void QV4::QmlIncubatorObject::statusChanged(QQmlIncubator::Status s) if (f) { QV4::JSCallData jsCallData(scope, 1); *jsCallData->thisObject = this; - jsCallData->args[0] = QV4::Primitive::fromUInt32(s); + jsCallData->args[0] = QV4::Value::fromUInt32(s); f->call(jsCallData); if (scope.hasException()) { QQmlError error = scope.engine->catchExceptionAsQmlError(); diff --git a/src/qml/qml/qqmllistwrapper.cpp b/src/qml/qml/qqmllistwrapper.cpp index dcbd3dd488..2f769c1aef 100644 --- a/src/qml/qml/qqmllistwrapper.cpp +++ b/src/qml/qml/qqmllistwrapper.cpp @@ -119,11 +119,11 @@ ReturnedValue QmlListWrapper::virtualGet(const Managed *m, PropertyKey id, const if (hasProperty) *hasProperty = false; - return Primitive::undefinedValue().asReturnedValue(); + return Value::undefinedValue().asReturnedValue(); } else if (id.isString()) { if (id == v4->id_length()->propertyKey() && !w->d()->object.isNull()) { quint32 count = w->d()->property().count ? w->d()->property().count(&w->d()->property()) : 0; - return Primitive::fromUInt32(count).asReturnedValue(); + return Value::fromUInt32(count).asReturnedValue(); } } diff --git a/src/qml/qml/qqmllocale.cpp b/src/qml/qml/qqmllocale.cpp index f9f13e7b7c..2b17037df0 100644 --- a/src/qml/qml/qqmllocale.cpp +++ b/src/qml/qml/qqmllocale.cpp @@ -512,7 +512,7 @@ ReturnedValue QQmlLocaleData::method_get_weekDays(const QV4::FunctionObject *b, int day = days.at(i); if (day == 7) // JS Date days in range 0(Sunday) to 6(Saturday) day = 0; - result->arrayPut(i, QV4::Primitive::fromInt32(day)); + result->arrayPut(i, QV4::Value::fromInt32(day)); } result->setArrayLengthUnchecked(days.size()); diff --git a/src/qml/qml/qqmlobjectcreator.cpp b/src/qml/qml/qqmlobjectcreator.cpp index 7a55ce78e0..c181d791f5 100644 --- a/src/qml/qml/qqmlobjectcreator.cpp +++ b/src/qml/qml/qqmlobjectcreator.cpp @@ -387,7 +387,7 @@ void QQmlObjectCreator::setPropertyValue(const QQmlPropertyData *property, const double n = binding->valueAsNumber(compilationUnit->constants); if (double(int(n)) == n) { if (property->isVarProperty()) { - _vmeMetaObject->setVMEProperty(property->coreIndex(), QV4::Primitive::fromInt32(int(n))); + _vmeMetaObject->setVMEProperty(property->coreIndex(), QV4::Value::fromInt32(int(n))); } else { int i = int(n); QVariant value(i); @@ -395,7 +395,7 @@ void QQmlObjectCreator::setPropertyValue(const QQmlPropertyData *property, const } } else { if (property->isVarProperty()) { - _vmeMetaObject->setVMEProperty(property->coreIndex(), QV4::Primitive::fromDouble(n)); + _vmeMetaObject->setVMEProperty(property->coreIndex(), QV4::Value::fromDouble(n)); } else { QVariant value(n); property->writeProperty(_qobject, &value, propertyWriteFlags); @@ -403,7 +403,7 @@ void QQmlObjectCreator::setPropertyValue(const QQmlPropertyData *property, const } } else if (binding->type == QV4::CompiledData::Binding::Type_Boolean) { if (property->isVarProperty()) { - _vmeMetaObject->setVMEProperty(property->coreIndex(), QV4::Primitive::fromBoolean(binding->valueAsBoolean())); + _vmeMetaObject->setVMEProperty(property->coreIndex(), QV4::Value::fromBoolean(binding->valueAsBoolean())); } else { QVariant value(binding->valueAsBoolean()); property->writeProperty(_qobject, &value, propertyWriteFlags); diff --git a/src/qml/qml/qqmltypewrapper.cpp b/src/qml/qml/qqmltypewrapper.cpp index c6affcb79c..cb4df7d912 100644 --- a/src/qml/qml/qqmltypewrapper.cpp +++ b/src/qml/qml/qqmltypewrapper.cpp @@ -205,7 +205,7 @@ ReturnedValue QQmlTypeWrapper::virtualGet(const Managed *m, PropertyKey id, cons bool ok = false; const int value = enumForSingleton(v4, name, qobjectSingleton, type, &ok); if (ok) - return QV4::Primitive::fromInt32(value).asReturnedValue(); + return QV4::Value::fromInt32(value).asReturnedValue(); } // check for property. @@ -237,7 +237,7 @@ ReturnedValue QQmlTypeWrapper::virtualGet(const Managed *m, PropertyKey id, cons bool ok = false; int value = type.enumValue(QQmlEnginePrivate::get(v4->qmlEngine()), name, &ok); if (ok) - return QV4::Primitive::fromInt32(value).asReturnedValue(); + return QV4::Value::fromInt32(value).asReturnedValue(); value = type.scopedEnumIndex(QQmlEnginePrivate::get(v4->qmlEngine()), name, &ok); if (ok) { @@ -447,7 +447,7 @@ ReturnedValue QQmlScopedEnumWrapper::virtualGet(const Managed *m, PropertyKey id if (hasProperty) *hasProperty = ok; if (ok) - return QV4::Primitive::fromInt32(value).asReturnedValue(); + return QV4::Value::fromInt32(value).asReturnedValue(); return Encode::undefined(); } diff --git a/src/qml/qml/qqmlvaluetypewrapper.cpp b/src/qml/qml/qqmlvaluetypewrapper.cpp index f885182a12..fb43834472 100644 --- a/src/qml/qml/qqmlvaluetypewrapper.cpp +++ b/src/qml/qml/qqmlvaluetypewrapper.cpp @@ -387,7 +387,7 @@ ReturnedValue QQmlValueTypeWrapper::virtualGet(const Managed *m, PropertyKey id, // Note: readReferenceValue() can change the reference->type. if (const QQmlValueTypeReference *reference = r->as<QQmlValueTypeReference>()) { if (!reference->readReferenceValue()) - return Primitive::undefinedValue().asReturnedValue(); + return Value::undefinedValue().asReturnedValue(); } QQmlPropertyData *result = r->d()->propertyCache()->property(name.getPointer(), nullptr, nullptr); diff --git a/src/qml/qml/qqmlvmemetaobject.cpp b/src/qml/qml/qqmlvmemetaobject.cpp index d01e089054..6bc469c836 100644 --- a/src/qml/qml/qqmlvmemetaobject.cpp +++ b/src/qml/qml/qqmlvmemetaobject.cpp @@ -107,7 +107,7 @@ void QQmlVMEVariantQObjectPtr::objectDestroyed(QObject *) QV4::Scoped<QV4::MemberData> sp(scope, m_target->propertyAndMethodStorage.value()); if (sp) { QV4::PropertyIndex index{ sp->d(), sp->d()->values.values + m_index }; - index.set(v4, QV4::Primitive::nullValue()); + index.set(v4, QV4::Value::nullValue()); } } @@ -368,21 +368,21 @@ void QQmlVMEMetaObject::writeProperty(int id, int v) { QV4::MemberData *md = propertyAndMethodStorageAsMemberData(); if (md) - md->set(engine, id, QV4::Primitive::fromInt32(v)); + md->set(engine, id, QV4::Value::fromInt32(v)); } void QQmlVMEMetaObject::writeProperty(int id, bool v) { QV4::MemberData *md = propertyAndMethodStorageAsMemberData(); if (md) - md->set(engine, id, QV4::Primitive::fromBoolean(v)); + md->set(engine, id, QV4::Value::fromBoolean(v)); } void QQmlVMEMetaObject::writeProperty(int id, double v) { QV4::MemberData *md = propertyAndMethodStorageAsMemberData(); if (md) - md->set(engine, id, QV4::Primitive::fromDouble(v)); + md->set(engine, id, QV4::Value::fromDouble(v)); } void QQmlVMEMetaObject::writeProperty(int id, const QString& v) @@ -1005,7 +1005,7 @@ QV4::ReturnedValue QQmlVMEMetaObject::readVarProperty(int id) const QV4::MemberData *md = propertyAndMethodStorageAsMemberData(); if (md) return (md->data() + id)->asReturnedValue(); - return QV4::Primitive::undefinedValue().asReturnedValue(); + return QV4::Value::undefinedValue().asReturnedValue(); } QVariant QQmlVMEMetaObject::readPropertyAsVariant(int id) const @@ -1122,7 +1122,7 @@ QV4::ReturnedValue QQmlVMEMetaObject::vmeMethod(int index) const return parentVMEMetaObject()->vmeMethod(index); } if (!compiledObject) - return QV4::Primitive::undefinedValue().asReturnedValue(); + return QV4::Value::undefinedValue().asReturnedValue(); const int plainSignals = compiledObject->nSignals + compiledObject->nProperties + compiledObject->nAliases; Q_ASSERT(index >= (methodOffset() + plainSignals) && index < (methodOffset() + plainSignals + int(compiledObject->nFunctions))); return method(index - methodOffset() - plainSignals); diff --git a/src/qml/qml/qqmlxmlhttprequest.cpp b/src/qml/qml/qqmlxmlhttprequest.cpp index c739a91fd5..9f629f974d 100644 --- a/src/qml/qml/qqmlxmlhttprequest.cpp +++ b/src/qml/qml/qqmlxmlhttprequest.cpp @@ -910,7 +910,7 @@ ReturnedValue NamedNodeMap::virtualGet(const Managed *m, PropertyKey id, const V return Object::virtualGet(m, id, receiver, hasProperty); if (id == v4->id_length()->propertyKey()) - return Primitive::fromInt32(r->d()->list().count()).asReturnedValue(); + return Value::fromInt32(r->d()->list().count()).asReturnedValue(); QString str = id.toQString(); for (int ii = 0; ii < r->d()->list().count(); ++ii) { @@ -950,7 +950,7 @@ ReturnedValue NodeList::virtualGet(const Managed *m, PropertyKey id, const Value } if (id == v4->id_length()->propertyKey()) - return Primitive::fromInt32(r->d()->d->children.count()).asReturnedValue(); + return Value::fromInt32(r->d()->d->children.count()).asReturnedValue(); return Object::virtualGet(m, id, receiver, hasProperty); } @@ -1690,11 +1690,11 @@ void Heap::QQmlXMLHttpRequestCtor::init(ExecutionEngine *engine) Scope scope(engine); Scoped<QV4::QQmlXMLHttpRequestCtor> ctor(scope, this); - ctor->defineReadonlyProperty(QStringLiteral("UNSENT"), Primitive::fromInt32(0)); - ctor->defineReadonlyProperty(QStringLiteral("OPENED"), Primitive::fromInt32(1)); - ctor->defineReadonlyProperty(QStringLiteral("HEADERS_RECEIVED"), Primitive::fromInt32(2)); - ctor->defineReadonlyProperty(QStringLiteral("LOADING"), Primitive::fromInt32(3)); - ctor->defineReadonlyProperty(QStringLiteral("DONE"), Primitive::fromInt32(4)); + ctor->defineReadonlyProperty(QStringLiteral("UNSENT"), Value::fromInt32(0)); + ctor->defineReadonlyProperty(QStringLiteral("OPENED"), Value::fromInt32(1)); + ctor->defineReadonlyProperty(QStringLiteral("HEADERS_RECEIVED"), Value::fromInt32(2)); + ctor->defineReadonlyProperty(QStringLiteral("LOADING"), Value::fromInt32(3)); + ctor->defineReadonlyProperty(QStringLiteral("DONE"), Value::fromInt32(4)); if (!ctor->d()->proto) ctor->setupProto(); ScopedString s(scope, engine->id_prototype()); @@ -1730,11 +1730,11 @@ void QQmlXMLHttpRequestCtor::setupProto() p->defineAccessorProperty(QStringLiteral("responseType"), method_get_responseType, method_set_responseType); // State values - p->defineReadonlyProperty(QStringLiteral("UNSENT"), Primitive::fromInt32(0)); - p->defineReadonlyProperty(QStringLiteral("OPENED"), Primitive::fromInt32(1)); - p->defineReadonlyProperty(QStringLiteral("HEADERS_RECEIVED"), Primitive::fromInt32(2)); - p->defineReadonlyProperty(QStringLiteral("LOADING"), Primitive::fromInt32(3)); - p->defineReadonlyProperty(QStringLiteral("DONE"), Primitive::fromInt32(4)); + p->defineReadonlyProperty(QStringLiteral("UNSENT"), Value::fromInt32(0)); + p->defineReadonlyProperty(QStringLiteral("OPENED"), Value::fromInt32(1)); + p->defineReadonlyProperty(QStringLiteral("HEADERS_RECEIVED"), Value::fromInt32(2)); + p->defineReadonlyProperty(QStringLiteral("LOADING"), Value::fromInt32(3)); + p->defineReadonlyProperty(QStringLiteral("DONE"), Value::fromInt32(4)); } diff --git a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp index e7899970ad..8feac26cdf 100644 --- a/src/qml/qml/v8/qqmlbuiltinfunctions.cpp +++ b/src/qml/qml/v8/qqmlbuiltinfunctions.cpp @@ -110,8 +110,8 @@ void Heap::QtObject::init(QQmlEngine *qmlEngine) { ScopedString str(scope); ScopedValue v(scope); - o->put((str = scope.engine->newString(QStringLiteral("Asynchronous"))), (v = QV4::Primitive::fromInt32(0))); - o->put((str = scope.engine->newString(QStringLiteral("Synchronous"))), (v = QV4::Primitive::fromInt32(1))); + o->put((str = scope.engine->newString(QStringLiteral("Asynchronous"))), (v = QV4::Value::fromInt32(0))); + o->put((str = scope.engine->newString(QStringLiteral("Synchronous"))), (v = QV4::Value::fromInt32(1))); } o->defineDefaultProperty(QStringLiteral("include"), QV4Include::method_include); @@ -183,7 +183,7 @@ ReturnedValue QtObject::findAndAdd(const QString *name, bool &foundProperty) con QMetaEnum enumerator = qtMetaObject->enumerator(d()->enumeratorIterator); for (int keyCount = enumerator.keyCount(); d()->keyIterator < keyCount; ++d()->keyIterator) { key = scope.engine->newString(QString::fromUtf8(enumerator.key(d()->keyIterator))); - value = QV4::Primitive::fromInt32(enumerator.value(d()->keyIterator)); + value = QV4::Value::fromInt32(enumerator.value(d()->keyIterator)); o->put(key, value); if (name && key->toQString() == *name) { ++d()->keyIterator; @@ -1106,8 +1106,8 @@ ReturnedValue QtObject::method_createQmlObject(const FunctionObject *b, const Va const QQmlError &error = errors.at(ii); errorstr += QLatin1String("\n ") + error.toString(); qmlerror = v4->newObject(); - qmlerror->put((s = v4->newString(QStringLiteral("lineNumber"))), (v = QV4::Primitive::fromInt32(error.line()))); - qmlerror->put((s = v4->newString(QStringLiteral("columnNumber"))), (v = QV4::Primitive::fromInt32(error.column()))); + qmlerror->put((s = v4->newString(QStringLiteral("lineNumber"))), (v = QV4::Value::fromInt32(error.line()))); + qmlerror->put((s = v4->newString(QStringLiteral("columnNumber"))), (v = QV4::Value::fromInt32(error.column()))); qmlerror->put((s = v4->newString(QStringLiteral("fileName"))), (v = v4->newString(error.url().toString()))); qmlerror->put((s = v4->newString(QStringLiteral("message"))), (v = v4->newString(error.description()))); qmlerrors->put(ii, qmlerror); diff --git a/src/qml/qml/v8/qv4domerrors.cpp b/src/qml/qml/v8/qv4domerrors.cpp index b680aa07da..7ad37d098f 100644 --- a/src/qml/qml/v8/qv4domerrors.cpp +++ b/src/qml/qml/v8/qv4domerrors.cpp @@ -48,23 +48,23 @@ void qt_add_domexceptions(ExecutionEngine *e) { Scope scope(e); ScopedObject domexception(scope, e->newObject()); - domexception->defineReadonlyProperty(QStringLiteral("INDEX_SIZE_ERR"), Primitive::fromInt32(DOMEXCEPTION_INDEX_SIZE_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("DOMSTRING_SIZE_ERR"), Primitive::fromInt32(DOMEXCEPTION_DOMSTRING_SIZE_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("HIERARCHY_REQUEST_ERR"), Primitive::fromInt32(DOMEXCEPTION_HIERARCHY_REQUEST_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("WRONG_DOCUMENT_ERR"), Primitive::fromInt32(DOMEXCEPTION_WRONG_DOCUMENT_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("INVALID_CHARACTER_ERR"), Primitive::fromInt32(DOMEXCEPTION_INVALID_CHARACTER_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("NO_DATA_ALLOWED_ERR"), Primitive::fromInt32(DOMEXCEPTION_NO_DATA_ALLOWED_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("NO_MODIFICATION_ALLOWED_ERR"), Primitive::fromInt32(DOMEXCEPTION_NO_MODIFICATION_ALLOWED_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("NOT_FOUND_ERR"), Primitive::fromInt32(DOMEXCEPTION_NOT_FOUND_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("NOT_SUPPORTED_ERR"), Primitive::fromInt32(DOMEXCEPTION_NOT_SUPPORTED_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("INUSE_ATTRIBUTE_ERR"), Primitive::fromInt32(DOMEXCEPTION_INUSE_ATTRIBUTE_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("INVALID_STATE_ERR"), Primitive::fromInt32(DOMEXCEPTION_INVALID_STATE_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("SYNTAX_ERR"), Primitive::fromInt32(DOMEXCEPTION_SYNTAX_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("INVALID_MODIFICATION_ERR"), Primitive::fromInt32(DOMEXCEPTION_INVALID_MODIFICATION_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("NAMESPACE_ERR"), Primitive::fromInt32(DOMEXCEPTION_NAMESPACE_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("INVALID_ACCESS_ERR"), Primitive::fromInt32(DOMEXCEPTION_INVALID_ACCESS_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("VALIDATION_ERR"), Primitive::fromInt32(DOMEXCEPTION_VALIDATION_ERR)); - domexception->defineReadonlyProperty(QStringLiteral("TYPE_MISMATCH_ERR"), Primitive::fromInt32(DOMEXCEPTION_TYPE_MISMATCH_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("INDEX_SIZE_ERR"), Value::fromInt32(DOMEXCEPTION_INDEX_SIZE_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("DOMSTRING_SIZE_ERR"), Value::fromInt32(DOMEXCEPTION_DOMSTRING_SIZE_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("HIERARCHY_REQUEST_ERR"), Value::fromInt32(DOMEXCEPTION_HIERARCHY_REQUEST_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("WRONG_DOCUMENT_ERR"), Value::fromInt32(DOMEXCEPTION_WRONG_DOCUMENT_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("INVALID_CHARACTER_ERR"), Value::fromInt32(DOMEXCEPTION_INVALID_CHARACTER_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("NO_DATA_ALLOWED_ERR"), Value::fromInt32(DOMEXCEPTION_NO_DATA_ALLOWED_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("NO_MODIFICATION_ALLOWED_ERR"), Value::fromInt32(DOMEXCEPTION_NO_MODIFICATION_ALLOWED_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("NOT_FOUND_ERR"), Value::fromInt32(DOMEXCEPTION_NOT_FOUND_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("NOT_SUPPORTED_ERR"), Value::fromInt32(DOMEXCEPTION_NOT_SUPPORTED_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("INUSE_ATTRIBUTE_ERR"), Value::fromInt32(DOMEXCEPTION_INUSE_ATTRIBUTE_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("INVALID_STATE_ERR"), Value::fromInt32(DOMEXCEPTION_INVALID_STATE_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("SYNTAX_ERR"), Value::fromInt32(DOMEXCEPTION_SYNTAX_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("INVALID_MODIFICATION_ERR"), Value::fromInt32(DOMEXCEPTION_INVALID_MODIFICATION_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("NAMESPACE_ERR"), Value::fromInt32(DOMEXCEPTION_NAMESPACE_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("INVALID_ACCESS_ERR"), Value::fromInt32(DOMEXCEPTION_INVALID_ACCESS_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("VALIDATION_ERR"), Value::fromInt32(DOMEXCEPTION_VALIDATION_ERR)); + domexception->defineReadonlyProperty(QStringLiteral("TYPE_MISMATCH_ERR"), Value::fromInt32(DOMEXCEPTION_TYPE_MISMATCH_ERR)); e->globalObject->defineDefaultProperty(QStringLiteral("DOMException"), domexception); } diff --git a/src/qml/qml/v8/qv4domerrors_p.h b/src/qml/qml/v8/qv4domerrors_p.h index 06a70a13e9..1842e46a9c 100644 --- a/src/qml/qml/v8/qv4domerrors_p.h +++ b/src/qml/qml/v8/qv4domerrors_p.h @@ -77,7 +77,7 @@ QT_BEGIN_NAMESPACE #define THROW_DOM(error, string) { \ QV4::ScopedValue v(scope, scope.engine->newString(QStringLiteral(string))); \ QV4::ScopedObject ex(scope, scope.engine->newErrorObject(v)); \ - ex->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("code"))), QV4::ScopedValue(scope, QV4::Primitive::fromInt32(error))); \ + ex->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("code"))), QV4::ScopedValue(scope, QV4::Value::fromInt32(error))); \ return scope.engine->throwError(ex); \ } diff --git a/src/qml/qml/v8/qv4sqlerrors.cpp b/src/qml/qml/v8/qv4sqlerrors.cpp index db8d130cef..3f1744a687 100644 --- a/src/qml/qml/v8/qv4sqlerrors.cpp +++ b/src/qml/qml/v8/qv4sqlerrors.cpp @@ -49,14 +49,14 @@ void qt_add_sqlexceptions(QV4::ExecutionEngine *engine) { Scope scope(engine); ScopedObject sqlexception(scope, engine->newObject()); - sqlexception->defineReadonlyProperty(QStringLiteral("UNKNOWN_ERR"), Primitive::fromInt32(SQLEXCEPTION_UNKNOWN_ERR)); - sqlexception->defineReadonlyProperty(QStringLiteral("DATABASE_ERR"), Primitive::fromInt32(SQLEXCEPTION_DATABASE_ERR)); - sqlexception->defineReadonlyProperty(QStringLiteral("VERSION_ERR"), Primitive::fromInt32(SQLEXCEPTION_VERSION_ERR)); - sqlexception->defineReadonlyProperty(QStringLiteral("TOO_LARGE_ERR"), Primitive::fromInt32(SQLEXCEPTION_TOO_LARGE_ERR)); - sqlexception->defineReadonlyProperty(QStringLiteral("QUOTA_ERR"), Primitive::fromInt32(SQLEXCEPTION_QUOTA_ERR)); - sqlexception->defineReadonlyProperty(QStringLiteral("SYNTAX_ERR"), Primitive::fromInt32(SQLEXCEPTION_SYNTAX_ERR)); - sqlexception->defineReadonlyProperty(QStringLiteral("CONSTRAINT_ERR"), Primitive::fromInt32(SQLEXCEPTION_CONSTRAINT_ERR)); - sqlexception->defineReadonlyProperty(QStringLiteral("TIMEOUT_ERR"), Primitive::fromInt32(SQLEXCEPTION_TIMEOUT_ERR)); + sqlexception->defineReadonlyProperty(QStringLiteral("UNKNOWN_ERR"), Value::fromInt32(SQLEXCEPTION_UNKNOWN_ERR)); + sqlexception->defineReadonlyProperty(QStringLiteral("DATABASE_ERR"), Value::fromInt32(SQLEXCEPTION_DATABASE_ERR)); + sqlexception->defineReadonlyProperty(QStringLiteral("VERSION_ERR"), Value::fromInt32(SQLEXCEPTION_VERSION_ERR)); + sqlexception->defineReadonlyProperty(QStringLiteral("TOO_LARGE_ERR"), Value::fromInt32(SQLEXCEPTION_TOO_LARGE_ERR)); + sqlexception->defineReadonlyProperty(QStringLiteral("QUOTA_ERR"), Value::fromInt32(SQLEXCEPTION_QUOTA_ERR)); + sqlexception->defineReadonlyProperty(QStringLiteral("SYNTAX_ERR"), Value::fromInt32(SQLEXCEPTION_SYNTAX_ERR)); + sqlexception->defineReadonlyProperty(QStringLiteral("CONSTRAINT_ERR"), Value::fromInt32(SQLEXCEPTION_CONSTRAINT_ERR)); + sqlexception->defineReadonlyProperty(QStringLiteral("TIMEOUT_ERR"), Value::fromInt32(SQLEXCEPTION_TIMEOUT_ERR)); engine->globalObject->defineDefaultProperty(QStringLiteral("SQLException"), sqlexception); } |